Open sharwell opened 5 years ago
I think this can be very easily achieved by the IDE diagnostic service invoking CompilationWithAnalyzers.GetAnalyzerSyntaxDiagnosticsAsync. I believe the current implementation takes the approach of filtering down the analyzers to those that specify DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis
and invoking CompilationWithAnalyzers.GetAnalysisResult
, which does not restrict the force completed actions. New implementation should not attempt to filter analyzers, but just invoke the above syntax-only API, so the core analyzer driver only force completes syntax tree actions.
Attempts to get or use the SemanticModel automatically cancel the execution of this analyzer's syntax tree actions for the syntax-only operations.
I don't think we need to do this. Analyzers registering syntax tree actions should not attempt to get semantic model, driver doesn't need to safeguard this.
Related to #31758
This flag is used by analyzers to support a fast syntax-only analysis prior to full semantic analysis. It should be possible to replace this analyzer-specified behavior with automatic behavior in the driver:
SyntaxTree
actions in "no-semantics mode". Attempts to get or use theSemanticModel
automatically cancel the execution of this analyzer's syntax tree actions for the syntax-only operations.SyntaxTree
actions in "semantics allowed" mode.We can extend this behavior to also support syntax node actions in no-semantics mode, a behavior not allowed by the current analyzer driver.