Skip to content

Commit 920ea11

Browse files
authored
Merge pull request #56050 from dotnet/merges/main-to-main-vs-deps
Merge main to main-vs-deps
2 parents e98d13d + f53b0fc commit 920ea11

File tree

73 files changed

+502
-799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+502
-799
lines changed

src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Microsoft.CodeAnalysis.CSharp;
1313
using Microsoft.CodeAnalysis.CSharp.Completion.Providers;
1414
using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion;
15-
using Microsoft.CodeAnalysis.Experiments;
1615
using Microsoft.CodeAnalysis.Options;
1716
using Microsoft.CodeAnalysis.Test.Utilities;
1817
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data;
@@ -43,9 +42,6 @@ protected override OptionSet WithChangedOptions(OptionSet options)
4342
.WithChangedOption(CompletionServiceOptions.TimeoutInMillisecondsForExtensionMethodImportCompletion, TimeoutInMilliseconds);
4443
}
4544

46-
protected override TestComposition GetComposition()
47-
=> base.GetComposition().AddParts(typeof(TestExperimentationService));
48-
4945
internal override Type GetCompletionProviderType()
5046
=> typeof(ExtensionMethodImportCompletionProvider);
5147

@@ -2016,7 +2012,7 @@ public void M(int x)
20162012
}}
20172013
}}";
20182014

2019-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, true);
2015+
TargetTypedCompletionFilterFeatureFlag = true;
20202016
var markup = CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp);
20212017

20222018
string expectedDescription = null;

src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Microsoft.CodeAnalysis.CSharp.Completion.Providers;
1313
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders;
1414
using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion;
15-
using Microsoft.CodeAnalysis.Experiments;
1615
using Microsoft.CodeAnalysis.Test.Utilities;
1716
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data;
1817
using Roslyn.Test.Utilities;
@@ -27,9 +26,6 @@ public partial class SymbolCompletionProviderTests : AbstractCSharpCompletionPro
2726
internal override Type GetCompletionProviderType()
2827
=> typeof(SymbolCompletionProvider);
2928

30-
protected override TestComposition GetComposition()
31-
=> base.GetComposition().AddParts(typeof(TestExperimentationService));
32-
3329
[Theory, Trait(Traits.Feature, Traits.Features.Completion)]
3430
[InlineData(SourceCodeKind.Regular)]
3531
[InlineData(SourceCodeKind.Script)]
@@ -10785,7 +10781,7 @@ class AnotherBuilder
1078510781
[Fact, Trait(Traits.Feature, Traits.Features.TargetTypedCompletion)]
1078610782
public async Task TestTargetTypeFilterWithExperimentEnabled()
1078710783
{
10788-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, true);
10784+
TargetTypedCompletionFilterFeatureFlag = true;
1078910785

1079010786
var markup =
1079110787
@"public class C
@@ -10804,7 +10800,7 @@ await VerifyItemExistsAsync(
1080410800
[Fact, Trait(Traits.Feature, Traits.Features.TargetTypedCompletion)]
1080510801
public async Task TestNoTargetTypeFilterWithExperimentDisabled()
1080610802
{
10807-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, false);
10803+
TargetTypedCompletionFilterFeatureFlag = false;
1080810804

1080910805
var markup =
1081010806
@"public class C
@@ -10823,7 +10819,7 @@ await VerifyItemExistsAsync(
1082310819
[Fact, Trait(Traits.Feature, Traits.Features.TargetTypedCompletion)]
1082410820
public async Task TestTargetTypeFilter_NotOnObjectMembers()
1082510821
{
10826-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, true);
10822+
TargetTypedCompletionFilterFeatureFlag = true;
1082710823

1082810824
var markup =
1082910825
@"public class C
@@ -10841,7 +10837,7 @@ await VerifyItemExistsAsync(
1084110837
[Fact, Trait(Traits.Feature, Traits.Features.TargetTypedCompletion)]
1084210838
public async Task TestTargetTypeFilter_NotNamedTypes()
1084310839
{
10844-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, true);
10840+
TargetTypedCompletionFilterFeatureFlag = true;
1084510841

1084610842
var markup =
1084710843
@"public class C
@@ -11384,7 +11380,7 @@ public void Test()
1138411380
public async Task TestTargetTypeCompletionDescription(string targetType, string expectedParameterList)
1138511381
{
1138611382
// Check the description displayed is based on symbol matches targeted type
11387-
SetExperimentOption(WellKnownExperimentNames.TargetTypedCompletionFilter, true);
11383+
TargetTypedCompletionFilterFeatureFlag = true;
1138811384

1138911385
var markup =
1139011386
$@"public class C

src/EditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Threading.Tasks;
1212
using Microsoft.CodeAnalysis.Completion;
1313
using Microsoft.CodeAnalysis.CSharp.Completion.Providers;
14-
using Microsoft.CodeAnalysis.Experiments;
1514
using Microsoft.CodeAnalysis.Options;
1615
using Microsoft.CodeAnalysis.Test.Utilities;
1716
using Roslyn.Test.Utilities;
@@ -39,15 +38,12 @@ protected override OptionSet WithChangedOptions(OptionSet options)
3938
.WithChangedOption(CompletionOptions.HideAdvancedMembers, LanguageNames.CSharp, HideAdvancedMembers);
4039
}
4140

42-
protected override TestComposition GetComposition()
43-
=> base.GetComposition().AddParts(typeof(TestExperimentationService));
44-
4541
#region "Option tests"
4642

4743
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
4844
public async Task OptionSetToNull_ExpEnabled()
4945
{
50-
SetExperimentOption(WellKnownExperimentNames.TypeImportCompletion, true);
46+
TypeImportCompletionFeatureFlag = true;
5147

5248
ShowImportCompletionItemsOptionValue = null;
5349

@@ -79,8 +75,7 @@ class Bar
7975
[Theory, Trait(Traits.Feature, Traits.Features.Completion)]
8076
public async Task OptionSetToFalse(bool isExperimentEnabled)
8177
{
82-
SetExperimentOption(WellKnownExperimentNames.TypeImportCompletion, isExperimentEnabled);
83-
78+
TypeImportCompletionFeatureFlag = isExperimentEnabled;
8479
ShowImportCompletionItemsOptionValue = false;
8580
IsExpandedCompletion = false;
8681

@@ -98,8 +93,7 @@ class Bar
9893
[Theory, Trait(Traits.Feature, Traits.Features.Completion)]
9994
public async Task OptionSetToTrue(bool isExperimentEnabled)
10095
{
101-
SetExperimentOption(WellKnownExperimentNames.TypeImportCompletion, isExperimentEnabled);
102-
96+
TypeImportCompletionFeatureFlag = isExperimentEnabled;
10397
ShowImportCompletionItemsOptionValue = true;
10498

10599
var markup = @"

src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
1313
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
1414
using Microsoft.CodeAnalysis.Editor.Tags;
15-
using Microsoft.CodeAnalysis.Experiments;
1615
using Microsoft.CodeAnalysis.Host.Mef;
1716
using Microsoft.CodeAnalysis.Options;
1817
using Microsoft.CodeAnalysis.Shared.TestHooks;
@@ -91,14 +90,8 @@ public SuggestedActionsSourceProvider(
9190
if (textBuffer.IsInLspEditorContext())
9291
return null;
9392

94-
var asyncEnabled = _optionService.GetOption(SuggestionsOptions.Asynchronous);
95-
if (asyncEnabled == null)
96-
{
97-
asyncEnabled =
98-
Workspace.TryGetWorkspace(textBuffer.AsTextContainer(), out var workspace) &&
99-
workspace.Services.GetService<IExperimentationService>() is { } experimentationService &&
100-
experimentationService.IsExperimentEnabled(WellKnownExperimentNames.AsynchronousQuickActions);
101-
}
93+
var asyncEnabled = _optionService.GetOption(SuggestionsOptions.Asynchronous) ??
94+
_optionService.GetOption(SuggestionsOptions.AsynchronousFeatureFlag);
10295

10396
return asyncEnabled == true
10497
? new AsyncSuggestedActionsSource(_threadingContext, this, textView, textBuffer, _suggestedActionCategoryRegistry)

src/EditorFeatures/Core/Implementation/AddImports/AbstractAddImportsPasteCommandHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
99
using Microsoft.CodeAnalysis.Editor.Shared.Options;
1010
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
11-
using Microsoft.CodeAnalysis.Experiments;
1211
using Microsoft.CodeAnalysis.Internal.Log;
1312
using Microsoft.CodeAnalysis.Shared.Extensions;
1413
using Microsoft.CodeAnalysis.Text;

src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/CompletionSource.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo;
1616
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
1717
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
18-
using Microsoft.CodeAnalysis.Experiments;
1918
using Microsoft.CodeAnalysis.LanguageServices;
2019
using Microsoft.CodeAnalysis.PooledObjects;
2120
using Microsoft.CodeAnalysis.Shared.Extensions;
@@ -138,13 +137,12 @@ public AsyncCompletionData.CompletionStartData InitializeCompletion(
138137
// For telemetry reporting purpose
139138
static void CheckForExperimentStatus(ITextView textView, Document document)
140139
{
141-
var workspace = document.Project.Solution.Workspace;
140+
var options = document.Project.Solution.Options;
142141

143-
var experimentationService = workspace.Services.GetRequiredService<IExperimentationService>();
144-
textView.Properties[TargetTypeFilterExperimentEnabled] = experimentationService.IsExperimentEnabled(WellKnownExperimentNames.TargetTypedCompletionFilter);
142+
textView.Properties[TargetTypeFilterExperimentEnabled] = options.GetOption(CompletionOptions.TargetTypedCompletionFilterFeatureFlag);
145143

146-
var importCompletionOptionValue = workspace.Options.GetOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, document.Project.Language);
147-
var importCompletionExperimentValue = experimentationService.IsExperimentEnabled(WellKnownExperimentNames.TypeImportCompletion);
144+
var importCompletionOptionValue = options.GetOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, document.Project.Language);
145+
var importCompletionExperimentValue = options.GetOption(CompletionOptions.TypeImportCompletionFeatureFlag);
148146
var isTypeImportEnababled = importCompletionOptionValue == true || (importCompletionOptionValue == null && importCompletionExperimentValue);
149147
textView.Properties[TypeImportCompletionEnabled] = isTypeImportEnababled;
150148
}

src/EditorFeatures/Core/Implementation/Suggestions/SuggestionsOptions.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66

77
namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
88
{
9-
internal class SuggestionsOptions
9+
internal static class SuggestionsOptions
1010
{
11-
public static Option2<bool?> Asynchronous =
12-
new(nameof(SuggestionsOptions), nameof(Asynchronous), defaultValue: null,
13-
storageLocation: new RoamingProfileStorageLocation("TextEditor.Specific.Suggestions.Asynchronous2"));
11+
private const string FeatureName = "SuggestionsOptions";
12+
13+
public static readonly Option2<bool?> Asynchronous = new(FeatureName, nameof(Asynchronous), defaultValue: null,
14+
new RoamingProfileStorageLocation("TextEditor.Specific.Suggestions.Asynchronous2"));
15+
16+
public static readonly Option2<bool> AsynchronousFeatureFlag = new(FeatureName, nameof(AsynchronousFeatureFlag), defaultValue: false,
17+
new FeatureFlagStorageLocation("Roslyn.AsynchronousQuickActions"));
1418
}
1519
}

src/EditorFeatures/Core/Implementation/Suggestions/SuggestionsOptionsProvider.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
1313
{
1414
[ExportOptionProvider, Shared]
15-
internal class SuggestionsOptionsProvider : IOptionProvider
15+
internal sealed class SuggestionsOptionsProvider : IOptionProvider
1616
{
1717
[ImportingConstructor]
1818
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
@@ -21,6 +21,7 @@ public SuggestionsOptionsProvider()
2121
}
2222

2323
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
24-
SuggestionsOptions.Asynchronous);
24+
SuggestionsOptions.Asynchronous,
25+
SuggestionsOptions.AsynchronousFeatureFlag);
2526
}
2627
}

src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ internal static class FeatureOnOffOptions
7878
nameof(FeatureOnOffOptions), nameof(OfferRemoveUnusedReferences), defaultValue: true,
7979
storageLocation: new RoamingProfileStorageLocation($"TextEditor.{nameof(OfferRemoveUnusedReferences)}"));
8080

81+
public static readonly Option<bool> OfferRemoveUnusedReferencesFeatureFlag = new(
82+
nameof(FeatureOnOffOptions), nameof(OfferRemoveUnusedReferencesFeatureFlag), defaultValue: false,
83+
new FeatureFlagStorageLocation("Roslyn.RemoveUnusedReferences"));
84+
8185
public static readonly PerLanguageOption2<bool?> ShowInheritanceMargin =
8286
new(nameof(FeatureOnOffOptions),
8387
nameof(ShowInheritanceMargin),
@@ -125,6 +129,7 @@ public FeatureOnOffOptionsProvider()
125129
FeatureOnOffOptions.UseEnhancedColors,
126130
FeatureOnOffOptions.AddImportsOnPaste,
127131
FeatureOnOffOptions.OfferRemoveUnusedReferences,
132+
FeatureOnOffOptions.OfferRemoveUnusedReferencesFeatureFlag,
128133
FeatureOnOffOptions.ShowInheritanceMargin,
129134
FeatureOnOffOptions.InheritanceMarginCombinedWithIndicatorMargin,
130135
FeatureOnOffOptions.AutomaticallyCompleteStatementOnSemicolon,

src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests.vb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7679,7 +7679,6 @@ namespace OtherNS
76797679
public class DES { }
76807680
}
76817681
</Document>,
7682-
extraExportedTypes:={GetType(TestExperimentationService)}.ToList(),
76837682
showCompletionInArgumentLists:=showCompletionInArgumentLists)
76847683

76857684
Dim workspace = state.Workspace
@@ -7729,7 +7728,6 @@ namespace NS
77297728

77307729
class ATaAaSaKa { }
77317730
} </Document>,
7732-
extraExportedTypes:={GetType(TestExperimentationService)}.ToList(),
77337731
showCompletionInArgumentLists:=showCompletionInArgumentLists)
77347732

77357733
Dim workspace = state.Workspace
@@ -7784,7 +7782,6 @@ namespace NS2
77847782
class MyTask3 { }
77857783
}
77867784
</Document>,
7787-
extraExportedTypes:={GetType(TestExperimentationService)}.ToList(),
77887785
showCompletionInArgumentLists:=showCompletionInArgumentLists)
77897786

77907787
Dim workspace = state.Workspace

0 commit comments

Comments
 (0)