-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add api to allow customizing options per DiagnosticAnalyzer #80200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add api to allow customizing options per DiagnosticAnalyzer #80200
Conversation
private const string DiagnosticCategory = "Compiler"; | ||
|
||
// internal for testing purposes only. | ||
internal const string AnalyzerExceptionDiagnosticId = "AD0001"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The meat of hte change is in this file.
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs
Outdated
Show resolved
Hide resolved
// can use the same instance across all actions. | ||
var context = new SemanticModelAnalysisContext( | ||
semanticModel, AnalyzerOptions, diagReporter.AddDiagnosticAction, | ||
semanticModel, options, diagReporter.AddDiagnosticAction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semanticModel, options, diagReporter.AddDiagnosticAction, | |
semanticModel, analyzerOptions, diagReporter.AddDiagnosticAction, |
Ok. Performance seems unchanged:
|
@dotnet/roslyn-compiler for eyes. Tnx :) |
@dotnet/roslyn-compiler for reviews :) |
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerOptions.cs
Outdated
Show resolved
Hide resolved
src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs
Outdated
Show resolved
Hide resolved
|
||
// Deduping map for the distinct AnalyzerConfigOptionsProvider we get back from getAnalyzerConfigOptionsProvider. | ||
// The common case in VS host is that there is generally only 1-2 of these providers. For example, a provider | ||
// that looks in editorconfig+vsoptions, and a provider that only looks in editorconfig. We only want to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR: I'm planning to enable analyzer redirecting in dev18 which would redirect built-in SDK analyzers to ones inserted in VS (to avoid compiler version mismatch). I'm not sure if that is going to break the logic of analyzer option loading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinging you offline :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked offline. We're good. The redirection tthat is done doesn't affect the status of these references as 'project references'. It just impacts the location they are loaded from. So we will still see these as project-level references, and will appropriately hookup the right non-fallback options.
@dotnet/roslyn-compiler for final set of eyes. |
API approved in #80143