55 instantiations of OptionKey2
Microsoft.CodeAnalysis.EditorFeatures (8)
EditorConfigSettings\Data\CodeStyleSetting.cs (4)
61var optionKey = new OptionKey2(option); 81var optionKey = new OptionKey2(option, options.Language); 102var optionKey = new OptionKey2(option); 116var optionKey = new OptionKey2(option, options.Language);
EditorConfigSettings\Data\Setting.cs (3)
48var optionKey = new OptionKey2(option); 61var optionKey = new OptionKey2(option, LanguageNames.CSharp); 76var optionKey = new OptionKey2(option);
EditorConfigSettings\Data\TieredAnalyzerConfigOptions.cs (1)
32initialValue = GlobalOptions.GetOption<TValue>(new OptionKey2(option, option.IsPerLanguage ? Language : null))!;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Options\GlobalOptionsTests.cs (2)
61=> GetOption<T>(new OptionKey2(option)); 64=> GetOption<T>(new OptionKey2(option, languageName));
Microsoft.CodeAnalysis.Features (2)
Options\EditorConfig\EditorConfigFileGenerator.cs (2)
49if (configOptions.TryGetOption(new OptionKey2(NamingStyleOptions.NamingPreferences, language), out NamingStylePreferences namingStylePreferences)) 69var optionKey = new OptionKey2(option, option.IsPerLanguage ? language : null);
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Features\Options\ClientFallbackAnalyzerConfigOptionsProvider.cs (1)
35var value = globalOptions.GetOption<object>(new OptionKey2(option, option.IsPerLanguage ? language : null));
Handler\Configuration\DidChangeConfigurationNotificationHandler.cs (1)
108optionsToUpdate.Add(KeyValuePair.Create(new OptionKey2(option, language: languageName), parsedValue));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Configuration\DidChangeConfigurationNotificationHandlerTest.cs (2)
177var valueInServer = globalOptionService.GetOption<object>(new OptionKey2(option, languageName)); 182var valueInServer = globalOptionService.GetOption<object>(new OptionKey2(option, null));
Options\SolutionAnalyzerConfigOptionsUpdaterTests.cs (2)
60new KeyValuePair<OptionKey2, object?>(new OptionKey2(FormattingOptions2.IndentationSize, LanguageNames.CSharp), 3), 61new KeyValuePair<OptionKey2, object?>(new OptionKey2(FormattingOptions2.IndentationSize, LanguageNames.VisualBasic), 5)
Microsoft.CodeAnalysis.Workspaces (13)
Options\GlobalOptionService.cs (4)
63=> GetOption<T>(new OptionKey2(option)); 66=> GetOption<T>(new OptionKey2(option, language)); 137=> SetGlobalOption(new OptionKey2(option), value); 140=> SetGlobalOption(new OptionKey2(option, language), value);
Options\SolutionOptionSet.cs (2)
55? _legacyGlobalOptions.GlobalOptions.GetOption<object?>(new OptionKey2(internallyDefinedOption, optionKey.Language)) 81var internallyDefined = _changedOptionKeys.Where(key => key.Option is IOption2).SelectAsArray(key => KeyValuePair.Create(new OptionKey2((IOption2)key.Option, key.Language), _values[key]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\IOptionReader.cs (6)
29=> options.TryGetOption<T>(new OptionKey2(option), out var value) ? value! : option.DefaultValue; 32=> options.TryGetOption<T>(new OptionKey2(option), out var value) ? value! : defaultValue; 35=> options.TryGetOption<T>(new OptionKey2(option, language), out var value) ? value! : option.DefaultValue; 38=> options.TryGetOption<T>(new OptionKey2(option, language), out var value) ? value! : defaultValue; 44=> options.TryGetOption<CodeStyleOption2<T>>(new OptionKey2(option), out var style) ? style!.Value : defaultValue; 50=> options.TryGetOption<CodeStyleOption2<T>>(new OptionKey2(option, language), out var style) ? style!.Value : defaultValue;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (1)
106=> new(option);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (5)
OptionsCollection.cs (5)
45=> _options[new OptionKey2(option)] = value; 48=> Add(new OptionKey2(option), value); 54=> Add(new OptionKey2(option), new CodeStyleOption2<T>(value, notification)); 57=> Add(new OptionKey2(option, languageName), value); 63=> Add(new OptionKey2(option, languageName), new CodeStyleOption2<T>(value, notification));
Microsoft.CodeAnalysis.Workspaces.UnitTests (10)
WorkspaceServiceTests\GlobalOptionServiceTests.cs (10)
124[KeyValuePair.Create(new OptionKey2(FormattingOptions2.NewLine, "lang"), (object?)"NEW_LINE")], 177var values = globalOptions.GetOptions([new OptionKey2(option1), new OptionKey2(option2)]); 183KeyValuePair.Create(new OptionKey2(option1), (object?)5), 184KeyValuePair.Create(new OptionKey2(option2), (object?)6), 185KeyValuePair.Create(new OptionKey2(option3), (object?)3), 194values = globalOptions.GetOptions([new OptionKey2(option1), new OptionKey2(option2), new OptionKey2(option3)]); 316var optionKey = new OptionKey2(option, language);
Microsoft.VisualStudio.LanguageServices (8)
EditorConfigSettings\Whitespace\ViewModel\IndentationSizeViewModel.cs (1)
27_key = new OptionKey2(FormattingOptions2.IndentationSize, LanguageNames.CSharp);
EditorConfigSettings\Whitespace\ViewModel\NewLineViewModel.cs (1)
27_key = new OptionKey2(FormattingOptions2.NewLine, LanguageNames.CSharp);
EditorConfigSettings\Whitespace\ViewModel\OperatorPlacementWhenWrappingViewModel.cs (1)
26_key = new OptionKey2(CodeStyleOptions2.OperatorPlacementWhenWrapping);
EditorConfigSettings\Whitespace\ViewModel\TabSizeViewModelFactory.cs (1)
25_key = new OptionKey2(FormattingOptions2.TabSize, LanguageNames.CSharp);
KeybindingReset\KeybindingResetDetector.cs (4)
62private static readonly ImmutableArray<OptionKey2> s_statusOptions = [new OptionKey2(KeybindingResetOptionsStorage.ReSharperStatus), new OptionKey2(KeybindingResetOptionsStorage.NeedsReset)]; 228KeyValuePair.Create(new OptionKey2(KeybindingResetOptionsStorage.ReSharperStatus), (object)currentStatus), 229KeyValuePair.Create(new OptionKey2(KeybindingResetOptionsStorage.NeedsReset), (object)needsReset),
Roslyn.VisualStudio.Next.UnitTests (1)
Options\VisualStudioSettingsOptionPersisterTests.cs (1)
115var optionKey = new OptionKey2(CSharpFormattingOptions2.NewLineBeforeOpenBrace);
111 references to OptionKey2
Microsoft.CodeAnalysis.EditorFeatures (13)
EditorConfigSettings\Data\CodeStyleSetting.cs (5)
12internal abstract class CodeStyleSetting(OptionKey2 optionKey, string description, OptionUpdater updater, SettingLocation location) : Setting(optionKey, description, updater, location) 61var optionKey = new OptionKey2(option); 81var optionKey = new OptionKey2(option, options.Language); 102var optionKey = new OptionKey2(option); 116var optionKey = new OptionKey2(option, options.Language);
EditorConfigSettings\Data\CodeStyleSetting`1.cs (1)
25OptionKey2 optionKey,
EditorConfigSettings\Data\EnumFlagsSetting.cs (1)
13OptionKey2 optionKey,
EditorConfigSettings\Data\Setting.cs (5)
14public OptionKey2 Key { get; } 20protected Setting(OptionKey2 optionKey, string description, OptionUpdater updater, SettingLocation location) 48var optionKey = new OptionKey2(option); 61var optionKey = new OptionKey2(option, LanguageNames.CSharp); 76var optionKey = new OptionKey2(option);
EditorConfigSettings\Data\Setting`1.cs (1)
12OptionKey2 optionKey,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
Options\GlobalOptionsTests.cs (8)
41public readonly List<OptionKey2> AccessedOptionKeys = []; 49private void OnOptionAccessed(OptionKey2 key) 54bool IOptionsReader.TryGetOption<T>(OptionKey2 optionKey, out T value) 66public T GetOption<T>(OptionKey2 optionKey) 74public ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey2> optionKeys) 77public bool RefreshOption(OptionKey2 optionKey, object? newValue) 86public void SetGlobalOption(OptionKey2 optionKey, object? value) 89public bool SetGlobalOptions(ImmutableArray<KeyValuePair<OptionKey2, object?>> options)
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (6)
RazorGlobalOptions.cs (6)
56public T GetOption<T>(OptionKey2 optionKey) => throw new NotImplementedException(); 58public bool RefreshOption(OptionKey2 optionKey, object? newValue) => throw new NotImplementedException(); 59public ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey2> optionKeys) => throw new NotImplementedException(); 62public void SetGlobalOption(OptionKey2 optionKey, object? value) => throw new NotImplementedException(); 63public bool SetGlobalOptions(ImmutableArray<KeyValuePair<OptionKey2, object?>> options) => throw new NotImplementedException(); 67bool IOptionsReader.TryGetOption<T>(OptionKey2 optionKey, out T value)
Microsoft.CodeAnalysis.Features (1)
Options\EditorConfig\EditorConfigFileGenerator.cs (1)
69var optionKey = new OptionKey2(option, option.IsPerLanguage ? language : null);
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\Configuration\DidChangeConfigurationNotificationHandler.cs (1)
96using var _ = ArrayBuilder<KeyValuePair<OptionKey2, object?>>.GetInstance(out var optionsToUpdate);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (3)
Options\SolutionAnalyzerConfigOptionsUpdaterTests.cs (3)
59new KeyValuePair<OptionKey2, object?>(FormattingOptions2.InsertFinalNewLine, true), 60new KeyValuePair<OptionKey2, object?>(new OptionKey2(FormattingOptions2.IndentationSize, LanguageNames.CSharp), 3), 61new KeyValuePair<OptionKey2, object?>(new OptionKey2(FormattingOptions2.IndentationSize, LanguageNames.VisualBasic), 5)
Microsoft.CodeAnalysis.Workspaces (38)
Options\GlobalOptionService.cs (18)
29private ImmutableDictionary<OptionKey2, object?> _currentValues = ImmutableDictionary.Create<OptionKey2, object?>(); 41private static object? LoadOptionFromPersisterOrGetDefault(OptionKey2 optionKey, ImmutableArray<IOptionPersister> persisters) 56bool IOptionsReader.TryGetOption<T>(OptionKey2 optionKey, out T value) 68public T GetOption<T>(OptionKey2 optionKey) 85public ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey2> optionKeys) 92foreach (var optionKey in optionKeys) 109foreach (var optionKey in optionKeys) 119private static object? GetOption_NoLock(ref ImmutableDictionary<OptionKey2, object?> currentValues, OptionKey2 optionKey, ImmutableArray<IOptionPersister> persisters) 142public void SetGlobalOption(OptionKey2 optionKey, object? value) 145public bool SetGlobalOptions(ImmutableArray<KeyValuePair<OptionKey2, object?>> options) 148private bool SetGlobalOptions(OneOrMany<KeyValuePair<OptionKey2, object?>> options) 150using var _ = ArrayBuilder<(OptionKey2, object?)>.GetInstance(options.Count, out var changedOptions); 185private static void PersistOption(ImmutableArray<IOptionPersister> persisters, OptionKey2 optionKey, object? value) 196public bool RefreshOption(OptionKey2 optionKey, object? newValue) 226private void RaiseOptionChangedEvent(ImmutableArray<(OptionKey2, object?)> changedOptions) 250_instance._currentValues = ImmutableDictionary.Create<OptionKey2, object?>();
Options\IGlobalOptionService.cs (5)
29T GetOption<T>(OptionKey2 optionKey); 35ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey2> optionKeys); 47void SetGlobalOption(OptionKey2 optionKey, object? value); 56bool SetGlobalOptions(ImmutableArray<KeyValuePair<OptionKey2, object?>> options); 65bool RefreshOption(OptionKey2 optionKey, object? newValue);
Options\ILegacyWorkspaceOptionService.cs (1)
31ImmutableArray<KeyValuePair<OptionKey2, object?>> internallyDefinedOptions,
Options\IOptionPersister.cs (2)
13bool TryFetch(OptionKey2 optionKey, out object? value); 14bool TryPersist(OptionKey2 optionKey, object? value);
Options\LegacyWorkspaceOptionService.cs (1)
52ImmutableArray<KeyValuePair<OptionKey2, object?>> internallyDefinedOptions,
Options\OptionChangedEventArgs.cs (2)
11internal sealed class OptionChangedEventArgs(ImmutableArray<(OptionKey2 key, object? newValue)> changedOptions) : EventArgs 13public ImmutableArray<(OptionKey2 key, object? newValue)> ChangedOptions => changedOptions;
Options\OptionKey.cs (3)
9/// <inheritdoc cref="OptionKey2"/> 13/// <inheritdoc cref="OptionKey2.Option"/> 16/// <inheritdoc cref="OptionKey2.Language"/>
Options\OptionSet.cs (1)
85bool IOptionsReader.TryGetOption<T>(OptionKey2 optionKey, out T value)
Options\SolutionOptionSet.cs (1)
79internal (ImmutableArray<KeyValuePair<OptionKey2, object?>> internallyDefined, ImmutableArray<KeyValuePair<OptionKey, object?>> externallyDefined) GetChangedOptions()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
55public bool TryGetOption<T>(OptionKey2 optionKey, out T value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\IOptionReader.cs (2)
12bool TryGetOption<T>(OptionKey2 optionKey, out T value); 19public bool TryGetOption<T>(OptionKey2 optionKey, out T value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (1)
105public static implicit operator OptionKey2(Option2<T> option)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (6)
OptionsCollection.cs (6)
28internal sealed class OptionsCollection(string languageName) : IReadOnlyCollection<KeyValuePair<OptionKey2, object?>>, IOptionsReader 30private readonly Dictionary<OptionKey2, object?> _options = []; 37public void Add<T>(OptionKey2 optionKey, T value) 69public void AddRange(IEnumerable<KeyValuePair<OptionKey2, object?>>? options) 78public IEnumerator<KeyValuePair<OptionKey2, object?>> GetEnumerator() 125public bool TryGetOption<T>(OptionKey2 optionKey, out T value)
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
WorkspaceServiceTests\GlobalOptionServiceTests.cs (2)
316var optionKey = new OptionKey2(option, language); 318optionService.SetOptions([new KeyValuePair<OptionKey2, object?>(optionKey, newValue)], []);
Microsoft.VisualStudio.LanguageServices (29)
EditorConfigSettings\Common\IEnumSettingViewModelFactory.cs (1)
12bool IsSupported(OptionKey2 key);
EditorConfigSettings\Whitespace\ViewModel\IndentationSizeViewModel.cs (2)
21private readonly OptionKey2 _key; 35public bool IsSupported(OptionKey2 key) => _key == key;
EditorConfigSettings\Whitespace\ViewModel\NewLineViewModel.cs (2)
21private readonly OptionKey2 _key; 35public bool IsSupported(OptionKey2 key) => _key == key;
EditorConfigSettings\Whitespace\ViewModel\OperatorPlacementWhenWrappingViewModel.cs (2)
20private readonly OptionKey2 _key; 34public bool IsSupported(OptionKey2 key) => _key == key;
EditorConfigSettings\Whitespace\ViewModel\TabSizeViewModelFactory.cs (2)
19private readonly OptionKey2 _key; 33public bool IsSupported(OptionKey2 key) => _key == key;
KeybindingReset\KeybindingResetDetector.cs (1)
62private static readonly ImmutableArray<OptionKey2> s_statusOptions = [new OptionKey2(KeybindingResetOptionsStorage.ReSharperStatus), new OptionKey2(KeybindingResetOptionsStorage.NeedsReset)];
Options\FeatureFlagPersister.cs (1)
23public bool TryFetch(OptionKey2 optionKey, string flagName, [NotNullWhen(true)] out object? value)
Options\LocalUserRegistryOptionPersister.cs (2)
40public bool TryFetch(OptionKey2 optionKey, string path, string key, out object? value) 122public void Persist(OptionKey2 optionKey, string path, string key, object? value)
Options\VisualStudioOptionPersister.cs (4)
28public bool TryFetch(OptionKey2 optionKey, out object? value) 34public bool TryFetch(VisualStudioOptionStorage storage, OptionKey2 optionKey, out object? value) 43public bool TryPersist(OptionKey2 optionKey, object? value) 55public Task PersistAsync(VisualStudioOptionStorage storage, OptionKey2 optionKey, object? value)
Options\VisualStudioOptionPersisterProvider.cs (1)
66private void RefreshOption(OptionKey2 optionKey, object? newValue)
Options\VisualStudioOptionStorage.cs (5)
62public Task PersistAsync(VisualStudioSettingsOptionPersister persister, OptionKey2 optionKey, object? value) 65public bool TryFetch(VisualStudioSettingsOptionPersister persister, OptionKey2 optionKey, out object? value) 84public bool TryFetch(FeatureFlagPersister persister, OptionKey2 optionKey, out object? value) 93public Task PersistAsync(LocalUserRegistryOptionPersister persister, OptionKey2 optionKey, object? value) 99public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 optionKey, out object? value)
Options\VisualStudioSettingsOptionPersister.cs (6)
27private readonly Action<OptionKey2, object?> _refreshOption; 34private ImmutableDictionary<string, (OptionKey2 primaryOptionKey, string primaryStorageKey)> _storageKeysToMonitorForChanges 35= ImmutableDictionary<string, (OptionKey2, string)>.Empty; 40public VisualStudioSettingsOptionPersister(Action<OptionKey2, object?> refreshOption, ImmutableDictionary<string, Lazy<IVisualStudioStorageReadFallback, OptionNameMetadata>> readFallbacks, ISettingsManager settingsManager) 63public bool TryFetch(OptionKey2 optionKey, string storageKey, out object? value) 89public Optional<object?> TryReadAndMonitorOptionValue(OptionKey2 primaryOptionKey, string primaryStorageKey, string storageKey, Type storageType, object? defaultValue)
Microsoft.VisualStudio.LanguageServices.CSharp (2)
EditorConfigSettings\BinaryOperatorSpacingOptionsViewModelFactory.cs (1)
29public bool IsSupported(OptionKey2 key)
EditorConfigSettings\LabelPositionOptionsViewModel.cs (1)
31public bool IsSupported(OptionKey2 key)
Roslyn.VisualStudio.Next.UnitTests (2)
Options\VisualStudioSettingsOptionPersisterTests.cs (2)
112var refreshedOptions = new List<(OptionKey2, object?)>(); 115var optionKey = new OptionKey2(CSharpFormattingOptions2.NewLineBeforeOpenBrace);