Skip to content

Commit

Permalink
Revert "Generalize RoamingProfileStorageLocation to ClientSettingsSto…
Browse files Browse the repository at this point in the history
…rageLocation (#62684)"

This reverts commit 51cc7c9.
  • Loading branch information
allisonchou committed Jul 18, 2022
1 parent 0d5ced4 commit 9c68f9b
Show file tree
Hide file tree
Showing 30 changed files with 470 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected bool TryGetController(EditorCommandArgs args, out Controller controlle
var languageName = args.SubjectBuffer.GetLanguageName();
if (args is not InvokeSignatureHelpCommandArgs &&
languageName != null &&
!_globalOptions.GetOption(SignatureHelpViewOptionsStorage.ShowSignatureHelp, languageName))
!_globalOptions.GetOption(SignatureHelpViewOptions.ShowSignatureHelp, languageName))
{
controller = null;
return false;
Expand Down
20 changes: 20 additions & 0 deletions src/EditorFeatures/Core/Options/NavigationBarViewOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;

namespace Microsoft.CodeAnalysis.Editor.Options
{
internal sealed class NavigationBarViewOptions
{
private const string FeatureName = "NavigationBarOptions";

public static readonly PerLanguageOption2<bool> ShowNavigationBar = new(FeatureName, "ShowNavigationBar", defaultValue: true);
}
}
15 changes: 0 additions & 15 deletions src/EditorFeatures/Core/Options/NavigationBarViewOptionsStorage.cs

This file was deleted.

20 changes: 20 additions & 0 deletions src/EditorFeatures/Core/Options/SignatureHelpViewOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;

namespace Microsoft.CodeAnalysis.Editor.Options
{
internal sealed class SignatureHelpViewOptions
{
private const string FeatureName = "SignatureHelpOptions";

public static readonly PerLanguageOption2<bool> ShowSignatureHelp = new(FeatureName, nameof(ShowSignatureHelp), defaultValue: true);
}
}
15 changes: 0 additions & 15 deletions src/EditorFeatures/Core/Options/SignatureHelpViewOptionsStorage.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ class C
</Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)

' disable implicit sig help then type a trigger character -> no session should be available
state.Workspace.GetService(Of IGlobalOptionService).SetGlobalOption(New OptionKey(SignatureHelpViewOptionsStorage.ShowSignatureHelp, LanguageNames.CSharp), False)
state.Workspace.GetService(Of IGlobalOptionService).SetGlobalOption(New OptionKey(SignatureHelpViewOptions.ShowSignatureHelp, LanguageNames.CSharp), False)

state.SendTypeChars("(")
Await state.AssertNoSignatureHelpSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ End Class
</Document>)

' disable implicit sig help then type a trigger character -> no session should be available
state.Workspace.GetService(Of IGlobalOptionService).SetGlobalOption(New OptionKey(SignatureHelpViewOptionsStorage.ShowSignatureHelp, LanguageNames.VisualBasic), False)
state.Workspace.GetService(Of IGlobalOptionService).SetGlobalOption(New OptionKey(SignatureHelpViewOptions.ShowSignatureHelp, LanguageNames.VisualBasic), False)
state.SendTypeChars("(")
Await state.AssertNoSignatureHelpSession()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Microsoft.CodeAnalysis.Diagnostics
{
internal sealed class DiagnosticOptionsStorage
internal sealed class DiagnosticOptions
{
private const string FeatureName = "DiagnosticOptions";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private async Task AnalyzeDocumentForKindAsync(TextDocument document, AnalysisKi
{
var analysisScope = new DocumentAnalysisScope(document, span: null, nonCachedStateSets.SelectAsArray(s => s.Analyzer), kind);
var executor = new DocumentAnalysisExecutor(analysisScope, compilationWithAnalyzers, _diagnosticAnalyzerRunner, logPerformanceInfo: true, onAnalysisException: OnAnalysisException);
var logTelemetry = GlobalOptions.GetOption(DiagnosticOptionsStorage.LogTelemetryForBackgroundAnalyzerExecution);
var logTelemetry = GlobalOptions.GetOption(DiagnosticOptions.LogTelemetryForBackgroundAnalyzerExecution);
foreach (var stateSet in nonCachedStateSets)
{
var computedData = await ComputeDocumentAnalysisDataAsync(executor, stateSet, logTelemetry, cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ public static CompletionOptions GetCompletionOptions(this IGlobalOptionService o
CompletionOptions.Default.SnippetCompletion,
new FeatureFlagStorageLocation("Roslyn.SnippetCompletion"));

public static readonly PerLanguageOption2<bool> HideAdvancedMembers = new(
"CompletionOptions", "HideAdvancedMembers", CompletionOptions.Default.HideAdvancedMembers,
new LocalClientSettingsStorageLocation("TextEditor.%LANGUAGE%.Hide Advanced Auto List Members"));
// This is serialized by the Visual Studio-specific LanguageSettingsPersister
public static readonly PerLanguageOption2<bool> HideAdvancedMembers = new(nameof(CompletionOptions), nameof(HideAdvancedMembers), CompletionOptions.Default.HideAdvancedMembers);

public static readonly PerLanguageOption2<bool> TriggerOnTyping = new(
"CompletionOptions", "TriggerOnTyping", CompletionOptions.Default.TriggerOnTyping,
new LocalClientSettingsStorageLocation("TextEditor.%LANGUAGE%.Auto List Members"));
// This is serialized by the Visual Studio-specific LanguageSettingsPersister
public static readonly PerLanguageOption2<bool> TriggerOnTyping = new(nameof(CompletionOptions), nameof(TriggerOnTyping), CompletionOptions.Default.TriggerOnTyping);

public static readonly PerLanguageOption2<bool> TriggerOnTypingLetters = new(nameof(CompletionOptions), nameof(TriggerOnTypingLetters), CompletionOptions.Default.TriggerOnTypingLetters,
storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.TriggerOnTypingLetters"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static DiagnosticMode GetDiagnosticMode(this IGlobalOptionService globalO
// If the workspace diagnostic mode is set to Default, defer to the feature flag service.
if (diagnosticModeOption == DiagnosticMode.Default)
{
return globalOptions.GetOption(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag) ? DiagnosticMode.Pull : DiagnosticMode.Push;
return globalOptions.GetOption(DiagnosticOptions.LspPullDiagnosticsFeatureFlag) ? DiagnosticMode.Pull : DiagnosticMode.Push;
}

// Otherwise, defer to the workspace+option to determine what mode we're in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task TestNoDocumentDiagnosticsForOpenFilesIfDefaultAndFeatureFlagOf
await OpenDocumentAsync(testLspServer, document);

// Ensure we get no diagnostics when feature flag is off.
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(new OptionKey(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag), false);
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(new OptionKey(DiagnosticOptions.LspPullDiagnosticsFeatureFlag), false);

await Assert.ThrowsAsync<StreamJsonRpc.RemoteInvocationException>(async () => await RunGetDocumentPullDiagnosticsAsync(testLspServer, document.GetURI(), useVSDiagnostics));
}
Expand All @@ -117,7 +117,7 @@ public async Task TestDocumentDiagnosticsForOpenFilesIfDefaultAndFeatureFlagOn(b
var document = testLspServer.GetCurrentSolution().Projects.Single().Documents.Single();
await OpenDocumentAsync(testLspServer, document);

testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(new OptionKey(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag), true);
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(new OptionKey(DiagnosticOptions.LspPullDiagnosticsFeatureFlag), true);

var results = await RunGetDocumentPullDiagnosticsAsync(testLspServer, document.GetURI(), useVSDiagnostics);
Assert.Equal("CS1513", results.Single().Diagnostics.Single().Code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void Enable_pull_diagnostics_experimental_requires_restart_CheckedChange
if (checkboxValue != null)
{
// Update the actual value of the feature flag to ensure CPS is informed of the new feature flag value.
this.OptionStore.SetOption(DiagnosticOptionsStorage.LspPullDiagnosticsFeatureFlag, checkboxValue.Value);
this.OptionStore.SetOption(DiagnosticOptions.LspPullDiagnosticsFeatureFlag, checkboxValue.Value);
}

// Update the workspace option.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void SetupView(IVsTextView view)
private void GlobalOptionChanged(object sender, OptionChangedEventArgs e)
{
if (e.Language != _languageService.RoslynLanguageName ||
e.Option != NavigationBarViewOptionsStorage.ShowNavigationBar)
e.Option != NavigationBarViewOptions.ShowNavigationBar)
{
return;
}
Expand Down Expand Up @@ -87,7 +87,7 @@ private void AddOrRemoveDropdown()
return;
}

var enabled = _globalOptions.GetOption(NavigationBarViewOptionsStorage.ShowNavigationBar, _languageService.RoslynLanguageName);
var enabled = _globalOptions.GetOption(NavigationBarViewOptions.ShowNavigationBar, _languageService.RoslynLanguageName);
if (enabled)
{
if (IsOurDropdownBar(dropdownManager, out var existingDropdownBar))
Expand Down
Loading

0 comments on commit 9c68f9b

Please sign in to comment.