dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.95k stars 4.02k forks source link

move compiler diagnostic analyzer back to IDE side #23247

Open heejaechang opened 6 years ago

heejaechang commented 6 years ago

currently we have this in compiler side. http://source.roslyn.io/#Microsoft.CodeAnalysis/DiagnosticAnalyzer/CompilerDiagnosticAnalyzer.cs,10

at the time, reasoning was that we shouldn't treat compiler diagnostic analyzer (which let IDE shows compiler errors) any special than third party diagnostic analyzer.

which is already not true, we special case compiler diagnostic analyzer all over in the IDE engine. and build doesn't even use compiler diagnostic analyzer. this pretending of us treating it same as others just made things more complicated.

also, we now even want to change behavior of compiler diagnostic analyzer (how much errors it produces such as decl errors only on top of no semantic errors and etc) based on some ide state such as project successfully loaded make things even more complicated.

probably it is just better to move this analyzer back into IDE so that we can special case this one.

no third party analyzer needs this kind of treatment (no semantic errors, decl only errors and etc)

heejaechang commented 6 years ago

tagging @jinujoseph @mavasani

heejaechang commented 6 years ago

related to https://github.com/dotnet/roslyn/pull/23246

as one of full experience we want to do when project is failed to load successfully.

sharwell commented 6 years ago

❓ Will this cause CompilationWithAnalyzers.GetAllDiagnosticsAsync to stop returning diagnostics representing compilation warnings/errors?

mavasani commented 6 years ago

@heejaechang We currently also have special performance hooks in the analyzer driver for compiler analyzer: http://source.roslyn.io/#Microsoft.CodeAnalysis/DiagnosticAnalyzer/AnalyzerManager.cs,166. How will we tackle these?