diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameSessionOptionsStorage.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameSessionOptionsStorage.cs index bb7197eaec312..63a6dfa25ae22 100644 --- a/src/EditorFeatures/Core/InlineRename/InlineRenameSessionOptionsStorage.cs +++ b/src/EditorFeatures/Core/InlineRename/InlineRenameSessionOptionsStorage.cs @@ -14,9 +14,8 @@ internal static class InlineRenameSessionOptionsStorage public static readonly Option2 RenameFile = new("dotnet_rename_file", defaultValue: true); public static readonly Option2 PreviewChanges = new("dotnet_preview_inline_rename_changes", defaultValue: false); - public static readonly Option2 CommitRenameAsynchronously = new("dotnet_commit_rename_asynchronously", defaultValue: null); - public static readonly Option2 CommitRenameAsynchronouslyFeatureFlag = new("dotnet_commit_rename_asynchronously_feature_flag", defaultValue: false); + public static readonly Option2 CommitRenameAsynchronously = new("dotnet_commit_rename_asynchronously", defaultValue: true); public static bool ShouldCommitAsynchronously(this IGlobalOptionService globalOptionService) - => globalOptionService.GetOption(CommitRenameAsynchronously) ?? globalOptionService.GetOption(CommitRenameAsynchronouslyFeatureFlag); + => globalOptionService.GetOption(CommitRenameAsynchronously); } diff --git a/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb b/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb index 19406ef40c3f5..5743c6ceae7db 100644 --- a/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb +++ b/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb @@ -6,6 +6,7 @@ Imports Microsoft.CodeAnalysis.Editor.Implementation.InlineRename Imports Microsoft.CodeAnalysis.Editor.InlineRename Imports Microsoft.CodeAnalysis.Editor.Shared.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions +Imports Microsoft.CodeAnalysis.InlineRename Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Text.Shared.Extensions Imports Microsoft.VisualStudio.Commanding @@ -1043,6 +1044,9 @@ partial class [|Program|] , host) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) + globalOptions.SetGlobalOption(InlineRenameSessionOptionsStorage.CommitRenameAsynchronously, False) + Dim view = workspace.Documents.Single().GetTextView() Dim commandHandler = CreateCommandHandler(workspace) @@ -1167,7 +1171,10 @@ partial class [|Program|] End Sub) End Sub - Private Shared Sub VerifyCommandCommitsRenameSessionAndExecutesCommand(host As RenameTestHost, executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action)) + Private Shared Sub VerifyCommandCommitsRenameSessionAndExecutesCommand( + host As RenameTestHost, + executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action), + Optional commitAsynchronously As Boolean = False) Using workspace = CreateWorkspaceWithWaiter( @@ -1181,6 +1188,9 @@ class [|C$$|] , host) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) + globalOptions.SetGlobalOption(InlineRenameSessionOptionsStorage.CommitRenameAsynchronously, commitAsynchronously) + Dim view = workspace.Documents.Single().GetTextView() view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value)) @@ -1241,7 +1251,10 @@ class [|C$$|] End Using End Function - Private Shared Sub VerifySessionCommittedAfterCutPasteOutsideIdentifier(host As RenameTestHost, executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action)) + Private Shared Sub VerifySessionCommittedAfterCutPasteOutsideIdentifier( + host As RenameTestHost, + executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action), + Optional commitAsynchronously As Boolean = False) Using workspace = CreateWorkspaceWithWaiter( @@ -1255,6 +1268,9 @@ class [|C$$|] , host) + Dim globalOptions = workspace.GetService(Of IGlobalOptionService) + globalOptions.SetGlobalOption(InlineRenameSessionOptionsStorage.CommitRenameAsynchronously, commitAsynchronously) + Dim view = workspace.Documents.Single().GetTextView() view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value)) diff --git a/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsService.cs b/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsService.cs index 94d3ef9577b0e..9bbd4d0857434 100644 --- a/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsService.cs +++ b/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsService.cs @@ -10,18 +10,10 @@ namespace Microsoft.CodeAnalysis.SolutionCrawler; [ExportWorkspaceService(typeof(ISolutionCrawlerOptionsService)), Shared] -internal sealed class SolutionCrawlerOptionsService : ISolutionCrawlerOptionsService +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class SolutionCrawlerOptionsService(IGlobalOptionService globalOptions) : ISolutionCrawlerOptionsService { - private readonly IGlobalOptionService _globalOptions; - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public SolutionCrawlerOptionsService(IGlobalOptionService globalOptions) - { - _globalOptions = globalOptions; - } - public bool EnableDiagnosticsInSourceGeneratedFiles - => _globalOptions.GetOption(SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles) ?? - _globalOptions.GetOption(SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFilesFeatureFlag); + => globalOptions.GetOption(SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles); } diff --git a/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsStorage.cs b/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsStorage.cs index 58c9deda09d2a..ca57a82cbc693 100644 --- a/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsStorage.cs +++ b/src/LanguageServer/Protocol/Features/Options/SolutionCrawlerOptionsStorage.cs @@ -23,11 +23,8 @@ internal static class SolutionCrawlerOptionsStorage public static readonly PerLanguageOption2 CompilerDiagnosticsScopeOption = new( "dotnet_compiler_diagnostics_scope", defaultValue: CompilerDiagnosticsScope.OpenFiles, group: s_backgroundAnalysisOptionGroup, serializer: EditorConfigValueSerializer.CreateSerializerForEnum()); - public static readonly Option2 EnableDiagnosticsInSourceGeneratedFiles = new( - "dotnet_enable_diagnostics_in_source_generated_files", defaultValue: null, group: s_backgroundAnalysisOptionGroup); - - public static readonly Option2 EnableDiagnosticsInSourceGeneratedFilesFeatureFlag = new( - "dotnet_enable_diagnostics_in_source_generated_files_feature_flag", defaultValue: false, group: s_backgroundAnalysisOptionGroup); + public static readonly Option2 EnableDiagnosticsInSourceGeneratedFiles = new( + "dotnet_enable_diagnostics_in_source_generated_files", defaultValue: true, group: s_backgroundAnalysisOptionGroup); /// /// Enables forced scope when low VM is detected to improve performance. diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 8511293fcac29..7b05d1dec46e3 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -68,11 +68,7 @@ public AdvancedOptionPageControl(OptionStore optionStore) : base(optionStore) BindToOption(Automatic_Run_generators_after_any_change, WorkspaceConfigurationOptionsStorage.SourceGeneratorExecution, SourceGeneratorExecutionPreference.Automatic); BindToOption(Balanced_Run_generators_after_saving_or_building, WorkspaceConfigurationOptionsStorage.SourceGeneratorExecution, SourceGeneratorExecutionPreference.Balanced); - BindToOption(Analyze_source_generated_files, SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles, () => - { - // If the option has not been set by the user, check if the option is enabled from experimentation. If so, default to that. - return optionStore.GetOption(SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFilesFeatureFlag); - }); + BindToOption(Analyze_source_generated_files, SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles); // Go To Definition BindToOption(Enable_navigation_to_sourcelink_and_embedded_sources, MetadataAsSourceOptionsStorage.NavigateToSourceLinkAndEmbeddedSources); @@ -80,10 +76,7 @@ public AdvancedOptionPageControl(OptionStore optionStore) : base(optionStore) BindToOption(Always_use_default_symbol_servers_for_navigation, MetadataAsSourceOptionsStorage.AlwaysUseDefaultSymbolServers); // Rename - BindToOption(Rename_asynchronously_exerimental, InlineRenameSessionOptionsStorage.CommitRenameAsynchronously, () => - { - return optionStore.GetOption(InlineRenameSessionOptionsStorage.CommitRenameAsynchronouslyFeatureFlag); - }); + BindToOption(Rename_asynchronously_exerimental, InlineRenameSessionOptionsStorage.CommitRenameAsynchronously); BindToOption(Rename_UI_setting, InlineRenameUIOptionsStorage.UseInlineAdornment, label: Rename_UI_setting_label); // Using Directives @@ -183,12 +176,7 @@ public AdvancedOptionPageControl(OptionStore optionStore) : base(optionStore) BindToOption(AutomaticallyOpenStackTraceExplorer, StackTraceExplorerOptionsStorage.OpenOnFocus); // Document Outline - BindToOption(EnableDocumentOutline, DocumentOutlineOptionsStorage.EnableDocumentOutline, () => - { - // If the option has not been set by the user, check if the option is disabled from experimentation. If - // so, default to reflect that. - return !optionStore.GetOption(DocumentOutlineOptionsStorage.DisableDocumentOutlineFeatureFlag); - }); + BindToOption(EnableDocumentOutline, DocumentOutlineOptionsStorage.EnableDocumentOutline); } // Since this dialog is constructed once for the lifetime of the application and VS Theme can be changed after the application has started, diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineOptionsStorage.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineOptionsStorage.cs index fcaed5dbf9336..c4d6d9ef9bf87 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineOptionsStorage.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineOptionsStorage.cs @@ -11,9 +11,7 @@ namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline; /// internal sealed class DocumentOutlineOptionsStorage { - public static readonly Option2 EnableDocumentOutline = new("visual_studio_enable_document_outline", defaultValue: null); - - public static readonly Option2 DisableDocumentOutlineFeatureFlag = new("visual_studio_disable_document_outline_feature_flag", defaultValue: false); + public static readonly Option2 EnableDocumentOutline = new("visual_studio_enable_document_outline", defaultValue: true); public static readonly Option2 DocumentOutlineSortOrder = new("visual_studio_document_outline_sort_order", defaultValue: SortOption.Location); } diff --git a/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs b/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs index e56b9e517e887..61926961f7fb5 100644 --- a/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs +++ b/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs @@ -244,8 +244,7 @@ private void GetOutline(out IntPtr phwnd) { phwnd = default; - var enabled = _globalOptions.GetOption(DocumentOutlineOptionsStorage.EnableDocumentOutline) - ?? !_globalOptions.GetOption(DocumentOutlineOptionsStorage.DisableDocumentOutlineFeatureFlag); + var enabled = _globalOptions.GetOption(DocumentOutlineOptionsStorage.EnableDocumentOutline); if (!enabled) return; diff --git a/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs b/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs index 3a0d0a73bacff..63aab8f719204 100644 --- a/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs +++ b/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs @@ -341,7 +341,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti {"dotnet_preview_inline_rename_changes", new RoamingProfileStorage("TextEditor.Specific.PreviewRename")}, {"dotnet_collapse_suggestions_in_inline_rename_ui", new RoamingProfileStorage("TextEditor.CollapseRenameSuggestionsUI")}, {"dotnet_commit_rename_asynchronously", new RoamingProfileStorage("TextEditor.Specific.CommitRenameAsynchronously")}, - {"dotnet_commit_rename_asynchronously_feature_flag", new FeatureFlagStorage("Roslyn.CommitRenameAsynchronously")}, {"dotnet_rename_get_suggestions_automatically", new FeatureFlagStorage(@"Editor.AutoSmartRenameSuggestions")}, // Option is deprecated, don't use the same RoamingProfileStorage key // {"dotnet_rename_asynchronously", new RoamingProfileStorage("TextEditor.Specific.RenameAsynchronously")}, @@ -401,7 +400,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti {"csharp_split_string_literal_on_return", new RoamingProfileStorage("TextEditor.CSharp.Specific.SplitStringLiterals")}, {"visual_studio_open_stack_trace_explorer_on_focus", new RoamingProfileStorage("StackTraceExplorer.Options.OpenOnFocus")}, {"visual_studio_enable_document_outline", new RoamingProfileStorage(@"DocumentOutline.Enable")}, - {"visual_studio_disable_document_outline_feature_flag", new FeatureFlagStorage(@"DocumentOutline.DisableFeature")}, {"visual_studio_document_outline_sort_order", new RoamingProfileStorage(@"DocumentOutline.SortOrder")}, {"visual_studio_enable_symbol_search", new LocalUserProfileStorage(@"Roslyn\Features\SymbolSearch", "Enabled")}, {"dotnet_unsupported_search_nuget_packages", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.SuggestForTypesInNuGetPackages")}, @@ -422,7 +420,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti {"visual_studio_navigate_to_object_browser", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.NavigateToObjectBrowser")}, {"dotnet_validate_compilation_tracker_states", new FeatureFlagStorage(@"Roslyn.ValidateCompilationTrackerStates")}, {"dotnet_enable_diagnostics_in_source_generated_files", new RoamingProfileStorage("TextEditor.Roslyn.Specific.EnableDiagnosticsInSourceGeneratedFilesExperiment")}, - {"dotnet_enable_diagnostics_in_source_generated_files_feature_flag", new FeatureFlagStorage(@"Roslyn.EnableDiagnosticsInSourceGeneratedFiles")}, {"dotnet_source_generator_execution", new RoamingProfileStorage("TextEditor.Roslyn.Specific.SourceGeneratorExecution")}, {"dotnet_reload_changed_analyzer_references", new LocalUserProfileStorage(@"Roslyn\Internal\OnOff\Features", "DotnetReloadChangedAnalyzerReferences")}, {"xaml_enable_lsp_intellisense", new FeatureFlagStorage(@"Xaml.EnableLspIntelliSense")}, diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 1ff67f37c23bf..289fd7463d7f8 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -73,17 +73,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(Automatic_Run_generators_after_any_change, WorkspaceConfigurationOptionsStorage.SourceGeneratorExecution, SourceGeneratorExecutionPreference.Automatic) BindToOption(Balanced_Run_generators_after_saving_or_building, WorkspaceConfigurationOptionsStorage.SourceGeneratorExecution, SourceGeneratorExecutionPreference.Balanced) - BindToOption(Analyze_source_generated_files, SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles, - Function() - ' If the option has not been set by the user, check if the option is enabled from experimentation. - Return optionStore.GetOption(SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFilesFeatureFlag) - End Function) + BindToOption(Analyze_source_generated_files, SolutionCrawlerOptionsStorage.EnableDiagnosticsInSourceGeneratedFiles) ' Rename - BindToOption(Rename_asynchronously_exerimental, InlineRenameSessionOptionsStorage.CommitRenameAsynchronously, - Function() - Return optionStore.GetOption(InlineRenameSessionOptionsStorage.CommitRenameAsynchronouslyFeatureFlag) - End Function) + BindToOption(Rename_asynchronously_exerimental, InlineRenameSessionOptionsStorage.CommitRenameAsynchronously) BindToOption(Rename_UI_setting, InlineRenameUIOptionsStorage.UseInlineAdornment, label:=Rename_UI_setting_label) ' Import directives @@ -174,12 +167,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(IncludeGlobalImports, InheritanceMarginOptionsStorage.InheritanceMarginIncludeGlobalImports, LanguageNames.VisualBasic) ' Document Outline - BindToOption(EnableDocumentOutline, DocumentOutlineOptionsStorage.EnableDocumentOutline, - Function() - ' If the option has Not been set by the user, check if the option is disabled from experimentation. - ' If so, default to reflect that. - Return Not optionStore.GetOption(DocumentOutlineOptionsStorage.DisableDocumentOutlineFeatureFlag) - End Function) + BindToOption(EnableDocumentOutline, DocumentOutlineOptionsStorage.EnableDocumentOutline) End Sub ' Since this dialog is constructed once for the lifetime of the application and VS Theme can be changed after the application has started,