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