65 instantiations of OptionKey
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
Completion\CompletionServiceTests.cs (3)
83Assert.Equal(1, options.GetOption(new OptionKey(ThirdPartyOption.Instance, LanguageNames.CSharp))); 115var options = new TestOptionSet(ImmutableDictionary<OptionKey, object>.Empty.Add(new OptionKey(ThirdPartyOption.Instance, LanguageNames.CSharp), 1)); 137workspace.CurrentSolution.Options.WithChangedOption(new OptionKey(ThirdPartyOption.Instance, LanguageNames.CSharp), 1))));
Workspaces\WorkspaceTests_EditorFeatures.cs (2)
1394var optionKey = new OptionKey(FormattingOptions2.SmartIndent, LanguageNames.CSharp); 1432var optionKey = new OptionKey(FormattingOptions2.SmartIndent, LanguageNames.CSharp);
Microsoft.CodeAnalysis.Workspaces (8)
Options\Option.cs (1)
109=> new(option);
Options\OptionSet.cs (7)
29return mapping.ToPublicOptionValue(GetInternalOptionValue(new OptionKey(mapping.InternalOption, optionKey.Language))); 48=> GetOption<T>(new OptionKey(option)); 54=> WithChangedOption(new OptionKey(option), value); 60=> GetOption<T>(new OptionKey(option, language)); 66=> WithChangedOption(new OptionKey(option, language), value); 76var mappedOptionKey = new OptionKey(mapping.InternalOption, optionAndLanguage.Language); 89value = (T)GetInternalOptionValue(new OptionKey(optionKey.Option, optionKey.Language))!;
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Options\OptionsTestHelpers.cs (1)
108updatedOptions = updatedOptions.WithChangedOption(new OptionKey(option, language), newValue);
OptionsCollection.cs (1)
85=> new TestOptionSet(_options.ToImmutableDictionary(entry => new OptionKey(entry.Key.Option, entry.Key.Language), entry => entry.Value));
Microsoft.CodeAnalysis.Workspaces.UnitTests (50)
Formatter\FormatterTests.cs (8)
74WithChangedOption(new OptionKey(FormattingOptions.UseTabs, NoCompilationConstants.LanguageName), false). 75WithChangedOption(new OptionKey(FormattingOptions.TabSize, NoCompilationConstants.LanguageName), 1). 76WithChangedOption(new OptionKey(FormattingOptions.IndentationSize, NoCompilationConstants.LanguageName), 7). 77WithChangedOption(new OptionKey(FormattingOptions.NewLine, NoCompilationConstants.LanguageName), "\n"); 87Add(new OptionKey(FormattingOptions.UseTabs, NoCompilationConstants.LanguageName), true). 88Add(new OptionKey(FormattingOptions.TabSize, NoCompilationConstants.LanguageName), 5). 89Add(new OptionKey(FormattingOptions.IndentationSize, NoCompilationConstants.LanguageName), 6). 90Add(new OptionKey(FormattingOptions.NewLine, NoCompilationConstants.LanguageName), "\r")) : null;
Options\DocumentOptionSetTests.cs (21)
24new OptionKey(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp), 52new OptionKey(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp), 77var optionKey = new OptionKey(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp); 109var optionKey = new OptionKey(legacyOption); 114Assert.Equal(newInternalValue, updatedSet.GetInternalOptionValue(new OptionKey(option))); 123.Add(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInTypes), false) 124.Add(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAccessors), true) 125.Add(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods), false)); 133Assert.True((bool?)set.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInTypes))); 134Assert.True((bool?)set.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInMethods))); 135Assert.False((bool?)set.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAccessors))); 136Assert.False((bool?)set.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods))); 137Assert.False((bool?)set.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInProperties))); 139var updatedSet = set.WithChangedOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInProperties), true); 141Assert.True((bool?)updatedSet.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInTypes))); 142Assert.True((bool?)updatedSet.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInMethods))); 143Assert.False((bool?)updatedSet.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAccessors))); 144Assert.False((bool?)updatedSet.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods))); 145Assert.True((bool?)updatedSet.GetOption(new OptionKey(CSharpFormattingOptions.NewLinesForBracesInProperties))); 164var optionKey = new OptionKey(legacyOption); 169Assert.Equal(newInternalValue, updatedSet.GetInternalOptionValue(new OptionKey(option)));
Options\OptionKeyTests.cs (9)
69var optionKey = new OptionKey(new TestOption() { IsPerLanguage = false }); 72Assert.Throws<ArgumentNullException>(() => new OptionKey(null!)); 73Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, null!)); 74Assert.Throws<ArgumentNullException>(() => new OptionKey(null!, "lang")); 75Assert.Throws<ArgumentNullException>(() => new OptionKey(new TestOption() { IsPerLanguage = true })); 76Assert.Throws<ArgumentException>(() => new OptionKey(new TestOption() { IsPerLanguage = false }, language: "lang")); 100var optionKey = new OptionKey(option); 111var optionKey = new OptionKey(option); 122var optionKey = new OptionKey(option, "BazLanguage");
Simplifier\SimplifierTests.cs (1)
120var key = new OptionKey(option, language);
WorkspaceServiceTests\GlobalOptionServiceTests.cs (10)
36var optionKey = new OptionKey(new TestOption() { DefaultValue = 1 }); 65var optionKey = new OptionKey(option); 66var perLanguageOptionKey = new OptionKey(perLanguageOption, "lang"); 99var perLanguageOptionKey = new OptionKey(FormattingOptions.NewLine, "lang"); 214var key = new OptionKey(option); 232var falseKey = new OptionKey(optionFalse); 235var trueKey = new OptionKey(optionTrue); 247var optionKey = new OptionKey(option); 263var optionKey = new OptionKey(option); 303var optionKey = new OptionKey(option, language);
WorkspaceTests\WorkspaceTests.cs (1)
205Assert.Equal(value, workspace2.Options.GetOption(new OptionKey(option, language)));
76 references to OptionKey
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (3)
Completion\CompletionServiceTests.cs (1)
115var options = new TestOptionSet(ImmutableDictionary<OptionKey, object>.Empty.Add(new OptionKey(ThirdPartyOption.Instance, LanguageNames.CSharp), 1));
Workspaces\WorkspaceTests_EditorFeatures.cs (2)
1394var optionKey = new OptionKey(FormattingOptions2.SmartIndent, LanguageNames.CSharp); 1432var optionKey = new OptionKey(FormattingOptions2.SmartIndent, LanguageNames.CSharp);
Microsoft.CodeAnalysis.ExternalAccess.Razor (1)
RazorGlobalOptions.cs (1)
63public ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey> optionKeys) => throw new NotImplementedException();
Microsoft.CodeAnalysis.Features (1)
ExternalAccess\Razor\Api\IRazorDocumentOptions.cs (1)
11bool TryGetDocumentOption(OptionKey option, out object? value);
Microsoft.CodeAnalysis.Workspaces (37)
Options\DocumentOptionSet.cs (6)
34private ImmutableDictionary<OptionKey, object?> _values; 37: this(configOptions, underlyingOptions, language, ImmutableDictionary<OptionKey, object?>.Empty) 41private DocumentOptionSet(StructuredAnalyzerConfigOptions? configOptions, OptionSet underlyingOptions, string language, ImmutableDictionary<OptionKey, object?> values) 52internal override object? GetInternalOptionValue(OptionKey optionKey) 70private bool TryGetAnalyzerConfigOption(OptionKey optionKey, out object? value) 100internal override OptionSet WithChangedOptionInternal(OptionKey optionKey, object? internalValue)
Options\EmptyOptionSet.cs (2)
13internal override object? GetInternalOptionValue(OptionKey optionKey) 16internal override OptionSet WithChangedOptionInternal(OptionKey optionKey, object? internalValue)
Options\ILegacyWorkspaceOptionService.cs (2)
28object? GetExternallyDefinedOption(OptionKey key); 32ImmutableArray<KeyValuePair<OptionKey, object?>> externallyDefinedOptions);
Options\LegacyWorkspaceOptionService.cs (4)
38private ImmutableDictionary<OptionKey, object?> _currentExternallyDefinedOptionValues; 46_currentExternallyDefinedOptionValues = ImmutableDictionary.Create<OptionKey, object?>(); 49public object? GetExternallyDefinedOption(OptionKey key) 63ImmutableArray<KeyValuePair<OptionKey, object?>> externallyDefinedOptions)
Options\Option.cs (1)
108public static implicit operator OptionKey(Option<T> option)
Options\OptionKey.cs (7)
13public readonly struct OptionKey : IEquatable<OptionKey> 44return obj is OptionKey key && 48public bool Equals(OptionKey other) 91public static bool operator ==(OptionKey left, OptionKey right) 94public static bool operator !=(OptionKey left, OptionKey right)
Options\OptionSet.cs (6)
20internal abstract object? GetInternalOptionValue(OptionKey optionKey); 25public object? GetOption(OptionKey optionKey) 40public T GetOption<T>(OptionKey optionKey) 72public virtual OptionSet WithChangedOption(OptionKey optionAndLanguage, object? value) 76var mappedOptionKey = new OptionKey(mapping.InternalOption, optionAndLanguage.Language); 84internal virtual OptionSet WithChangedOptionInternal(OptionKey optionKey, object? internalValue)
Options\SolutionOptionSet.cs (9)
25private ImmutableDictionary<OptionKey, object?> _values; 30private readonly ImmutableHashSet<OptionKey> _changedOptionKeys; 34ImmutableDictionary<OptionKey, object?> values, 35ImmutableHashSet<OptionKey> changedOptionKeys) 43: this(globalOptions, values: ImmutableDictionary<OptionKey, object?>.Empty, changedOptionKeys: ImmutableHashSet<OptionKey>.Empty) 48internal override object? GetInternalOptionValue(OptionKey optionKey) 62internal override OptionSet WithChangedOptionInternal(OptionKey optionKey, object? internalValue) 80internal (ImmutableArray<KeyValuePair<OptionKey2, object?>> internallyDefined, ImmutableArray<KeyValuePair<OptionKey, object?>> externallyDefined) GetChangedOptions()
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (5)
Fakes\TestOptionSet.cs (5)
14public static new readonly TestOptionSet Empty = new(ImmutableDictionary<OptionKey, object?>.Empty); 16private readonly ImmutableDictionary<OptionKey, object?> _values; 18public TestOptionSet(ImmutableDictionary<OptionKey, object?> values) 24internal override object? GetInternalOptionValue(OptionKey optionKey) 27internal override OptionSet WithChangedOptionInternal(OptionKey optionKey, object? internalValue)
Microsoft.CodeAnalysis.Workspaces.UnitTests (29)
Formatter\FormatterTests.cs (1)
86var options = passExplicitOptions ? new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty.
Options\DocumentOptionSetTests.cs (9)
23var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty.Add( 51var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty.Add( 73var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty); 77var optionKey = new OptionKey(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.CSharp); 90var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty); 109var optionKey = new OptionKey(legacyOption); 122var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty 151var underlyingSet = new TestOptionSet(ImmutableDictionary<OptionKey, object?>.Empty); 164var optionKey = new OptionKey(legacyOption);
Options\OptionKeyTests.cs (6)
69var optionKey = new OptionKey(new TestOption() { IsPerLanguage = false }); 100var optionKey = new OptionKey(option); 111var optionKey = new OptionKey(option); 122var optionKey = new OptionKey(option, "BazLanguage"); 133var optionKey = default(OptionKey);
Simplifier\SimplifierTests.cs (1)
120var key = new OptionKey(option, language);
WorkspaceServiceTests\GlobalOptionServiceTests.cs (12)
36var optionKey = new OptionKey(new TestOption() { DefaultValue = 1 }); 65var optionKey = new OptionKey(option); 66var perLanguageOptionKey = new OptionKey(perLanguageOption, "lang"); 99var perLanguageOptionKey = new OptionKey(FormattingOptions.NewLine, "lang"); 128ImmutableArray<KeyValuePair<OptionKey, object?>>.Empty); 214var key = new OptionKey(option); 232var falseKey = new OptionKey(optionFalse); 235var trueKey = new OptionKey(optionTrue); 247var optionKey = new OptionKey(option); 263var optionKey = new OptionKey(option); 303var optionKey = new OptionKey(option, language); 319optionService.SetOptions(ImmutableArray.Create(new KeyValuePair<OptionKey2, object?>(optionKey, newValue)), ImmutableArray<KeyValuePair<OptionKey, object?>>.Empty);