-
Notifications
You must be signed in to change notification settings - Fork 4.2k
added a way to specify ordering of Document/ProjectDiagnosticAnalyzers #24673
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,6 +282,11 @@ internal Action<Exception, DiagnosticAnalyzer, Diagnostic> GetOnAnalyzerExceptio | |
| return Owner.GetOnAnalyzerException(projectId, DiagnosticLogAggregator); | ||
| } | ||
|
|
||
| internal IEnumerable<DiagnosticAnalyzer> GetAnalyzersTestOnly(Project project) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 It would be good to create an enforced
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure. we could create enforcer once we have call graph I believe with attribute. |
||
| { | ||
| return _stateManager.GetOrCreateStateSets(project).Select(s => s.Analyzer); | ||
| } | ||
|
|
||
| private static string GetDocumentLogMessage(string title, Document document, DiagnosticAnalyzer analyzer) | ||
| { | ||
| return $"{title}: ({document.FilePath ?? document.Name}), ({analyzer.ToString()})"; | ||
|
|
||
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.
I really don't like that we are tracking four different things now for analyzer prioritization.
DocumentDiagnosticAnalyzerProjectDiagnosticAnalyzerEach of these four uses a different prioritization mechanism, and none of them leverage the functionality which users come to expect with MEF/VS (
OrderAttribute/ExtensionOrderAttribute).❓ What are our alternatives to unify and simplify this behavior?
Uh oh!
There was an error while loading. Please reload this page.
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.
DiagnosticAnalyzer doesn't use MEF. and I dont like OrderAttribute which require one to explicitly specify what comes before and after. that is just overkill for what is asked and get pretty complex fast. we used them and probably still use in some cases such as command handler, but we just hated them I believe. since whenever new one is added, one had to change multiple ones to adjust order. it is only suitable for ones that order must be declared quite clearly. this is not the case.
...
we have 4 different groups of analyzers (C#/VB compiler analyzer which is special, regular diagnostic analyzer, Document/ProjectDiagnosticAnalyzer, analyzer that implements IBuiltInAnalyzer). Engine treats them differently. reason is simple. since we want to allow special ability third party analyzer (regular diagnostic analyzer) can't use.
sure, we can have an issue tracking whether we should expose this special ability to third party or not. but that is not something this PR is about.