1 instantiation of AnalyzerConfig
Microsoft.CodeAnalysis (1)
CommandLine\AnalyzerConfig.cs (1)
262return new AnalyzerConfig(globalSection!, namedSectionBuilder.ToImmutable(), pathToFile);
137 references to AnalyzerConfig
Microsoft.CodeAnalysis (34)
CommandLine\AnalyzerConfig.cs (5)
104/// Comparer for sorting <see cref="AnalyzerConfig"/> files by <see cref="NormalizedDirectory"/> path length. 106internal static Comparer<AnalyzerConfig> DirectoryLengthComparer { get; } = Comparer<AnalyzerConfig>.Create( 178public static AnalyzerConfig Parse(string text, string? pathToFile) 187public static AnalyzerConfig Parse(SourceText text, string? pathToFile)
CommandLine\AnalyzerConfigSet.cs (25)
18using static Microsoft.CodeAnalysis.AnalyzerConfig; 25/// Represents a set of <see cref="AnalyzerConfig"/>, and can compute the effective analyzer options for a given source file. This is used to 26/// collect all the <see cref="AnalyzerConfig"/> files for that would apply to a compilation. 31/// The list of <see cref="AnalyzerConfig" />s in this set. This list has been sorted per <see cref="AnalyzerConfig.DirectoryLengthComparer"/>. 34private readonly ImmutableArray<AnalyzerConfig> _analyzerConfigs; 40/// corresponds to each <see cref="AnalyzerConfig.NamedSections"/>. 121public static AnalyzerConfigSet Create<TList>(TList analyzerConfigs) where TList : IReadOnlyCollection<AnalyzerConfig> 126public static AnalyzerConfigSet Create<TList>(TList analyzerConfigs, out ImmutableArray<Diagnostic> diagnostics) where TList : IReadOnlyCollection<AnalyzerConfig> 128var sortedAnalyzerConfigs = ArrayBuilder<AnalyzerConfig>.GetInstance(analyzerConfigs.Count); 130sortedAnalyzerConfigs.Sort(AnalyzerConfig.DirectoryLengthComparer); 136private AnalyzerConfigSet(ImmutableArray<AnalyzerConfig> analyzerConfigs, GlobalAnalyzerConfig globalConfig) 143foreach (var config in _analyzerConfigs) 150SectionNameMatcher? matcher = AnalyzerConfig.TryCreateSectionNameMatcher(section.Name); 172/// Returns a <see cref="AnalyzerConfigOptionsResult"/> for a source file. This computes which <see cref="AnalyzerConfig"/> rules applies to this file, and correctly applies 206var config = _analyzerConfigs[analyzerConfigIndex]; 273AnalyzerConfig config = _analyzerConfigs[analyzerConfigIndex]; 450/// <param name="analyzerConfigs">An <see cref="ArrayBuilder{T}"/> of <see cref="AnalyzerConfig"/> containing a mix of regular and unmerged partial global configs</param> 453internal static GlobalAnalyzerConfig MergeGlobalConfigs(ArrayBuilder<AnalyzerConfig> analyzerConfigs, out ImmutableArray<Diagnostic> diagnostics) 483internal void MergeIntoGlobalConfig(AnalyzerConfig config, DiagnosticBag diagnostics) 636/// We parse all <see cref="AnalyzerConfig"/>s as individual files, according to the editorconfig spec. 644internal AnalyzerConfig.Section GlobalSection { get; } 646internal ImmutableArray<AnalyzerConfig.Section> NamedSections { get; } 648public GlobalAnalyzerConfig(AnalyzerConfig.Section globalSection, ImmutableArray<AnalyzerConfig.Section> namedSections)
CommandLine\CommonCompiler.cs (3)
301var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(analyzerConfigPaths.Length); 319var editorConfig = AnalyzerConfig.Parse(fileContent, normalizedPath);
DiagnosticAnalyzer\AnalyzerConfigOptions.cs (1)
17public static StringComparer KeyComparer { get; } = AnalyzerConfig.Section.PropertiesKeyComparer;
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\TestSyntaxTreeOptionsProvider.cs (1)
9using static Microsoft.CodeAnalysis.AnalyzerConfig;
Microsoft.CodeAnalysis.UnitTests (96)
Analyzers\AnalyzerConfigTests.cs (96)
15using static Microsoft.CodeAnalysis.AnalyzerConfig; 25private static AnalyzerConfig ParseConfigFile(string text) => Parse(text, "/.editorconfig"); 30var config = Parse(@" 65var config = ParseConfigFile(@"is_global = true 101var config = ParseConfigFile(@"is_global = true 122var config = Parse(@"is_global = true 157var config = Parse("", path); 166var config = ParseConfigFile(@" 180var config = ParseConfigFile(@" 192var config = ParseConfigFile(@" 204var config = ParseConfigFile(string.Join(Environment.NewLine, 205AnalyzerConfig.ReservedKeys.Select(k => "MY_" + k + " = MY_VAL"))); 207AnalyzerConfig.ReservedKeys.Select(k => KeyValuePair.Create("my_" + k, "MY_VAL")).ToList(), 214var config = ParseConfigFile(@" 225var config = ParseConfigFile(@" 236var config = ParseConfigFile(@" 249var config = ParseConfigFile(@" 263var config = ParseConfigFile(@" 276var config = ParseConfigFile(@" 288var config = ParseConfigFile(@" 299var config = ParseConfigFile(@" 313var config = ParseConfigFile(@" 330var config = ParseConfigFile(@" 343var config = ParseConfigFile(@" 352var config = ParseConfigFile(string.Join(Environment.NewLine, 353AnalyzerConfig.ReservedValues.Select(v => "MY_KEY" + (index++) + " = " + v.ToUpperInvariant()))); 356AnalyzerConfig.ReservedValues.Select(v => KeyValuePair.Create("my_key" + (index++), v)).ToList(), 363var config = ParseConfigFile(string.Join(Environment.NewLine, 364AnalyzerConfig.ReservedKeys.Select(k => k + " = MY_VAL"))); 366AnalyzerConfig.ReservedKeys.Select(k => KeyValuePair.Create(k, "my_val")).ToList(), 950var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 982var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1000var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1023var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1050var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1072var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1094var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1118var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1151var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1173var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1204var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1225private AnalyzerConfigOptionsResult[] GetAnalyzerConfigOptions(string[] filePaths, ArrayBuilder<AnalyzerConfig> configs) 1280var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1301var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1328var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1353var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1381var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1419var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1451var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1498var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1527var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1558var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1581var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1600var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1624var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1637var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1653var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1672var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1695var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1746var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1763var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1784var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1798var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1816var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1839var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1876var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1932var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1953var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1974var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 1993var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2023var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2041var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2063var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2088var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2110var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2140var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2164var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2232var set = AnalyzerConfigSet.Create(ImmutableArray<AnalyzerConfig>.Empty); 2277var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2329var config = Parse("", fileName); 2336var config = Parse("global_level = 5", "/.editorconfig"); 2343var config = Parse("", "/" + AnalyzerConfig.UserGlobalConfigName); 2352var config = Parse("global_level = 5", "/" + AnalyzerConfig.UserGlobalConfigName); 2361var config = Parse("is_global = true", "/.nugetconfig"); 2370var config = Parse("global_level = 123", "/.globalconfig"); 2383var config = Parse(@" 2409var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2436var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2473var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2504var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2554var userGlobalConfig = Parse($@" 2559var nonUserGlobalConfig = Parse($@" 2596var configs = ArrayBuilder<AnalyzerConfig>.GetInstance(); 2622var configs = ArrayBuilder<AnalyzerConfig>.GetInstance();
Microsoft.CodeAnalysis.Workspaces (6)
Workspace\Solution\AnalyzerConfigDocumentState.cs (6)
15private readonly AsyncLazy<AnalyzerConfig> _lazyAnalyzerConfig; 23AsyncLazy<AnalyzerConfig>? lazyAnalyzerConfig = null) 27asynchronousComputeFunction: static async (self, cancellationToken) => AnalyzerConfig.Parse(await self.GetTextAsync(cancellationToken).ConfigureAwait(false), self.FilePath), 28synchronousComputeFunction: static (self, cancellationToken) => AnalyzerConfig.Parse(self.GetTextSynchronously(cancellationToken), self.FilePath), 79public AnalyzerConfig GetAnalyzerConfig(CancellationToken cancellationToken) 82public Task<AnalyzerConfig> GetAnalyzerConfigAsync(CancellationToken cancellationToken)