-
Notifications
You must be signed in to change notification settings - Fork 4k
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 BuildOnlyDiagnosticIds LSP request handler #69475
Conversation
Work towards dotnet/vscode-csharp#5728 Exposes an LSP API to fetch build-only diagnostic IDs for the given solution snapshot. This API will be invoked from VSCode C# extension on execution of explicit build/rebuild commands to separate out build-only and live diagnostics. See dotnet/vscode-csharp#5728 (comment) for details.
Work towards dotnet#5728. Follow-up to dotnet/roslyn#69475. C# extension can now invoke `getBuildOnlyDiagnosticIds` API after each explicit build/rebuild command to identify build-only diagnostic IDs.
src/Features/LanguageServer/Protocol/Handler/Diagnostics/BuildOnlyDiagnosticIdsHandler.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Handler/Diagnostics/BuildOnlyDiagnosticIdsHandler.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Handler/Diagnostics/BuildOnlyDiagnosticIdsHandler.cs
Outdated
Show resolved
Hide resolved
… the solution + address feedback
ping @genlu @CyrusNajmabadi for review |
@genlu @CyrusNajmabadi can you please review? |
internal sealed class BuildOnlyDiagnosticIdsHandler( | ||
DiagnosticAnalyzerInfoCache.SharedGlobalCache globalCache, | ||
[ImportMany] IEnumerable<Lazy<ILspBuildOnlyDiagnostics, ILspBuildOnlyDiagnosticsMetadata>> compilerBuildOnlyDiagnosticsProviders) | ||
: ILspServiceRequestHandler<BuildOnlyDiagnosticIdsResult> |
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.
indentation.
[ImportMany] IEnumerable<Lazy<ILspBuildOnlyDiagnostics, ILspBuildOnlyDiagnosticsMetadata>> compilerBuildOnlyDiagnosticsProviders) | ||
: ILspServiceRequestHandler<BuildOnlyDiagnosticIdsResult> | ||
{ | ||
public const string BuildOnlyDiagnosticIdsMethodName = "workspace/buildOnlyDiagnosticIds"; |
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.
is this a well known lsp method? or a roslyn extension?
public const string BuildOnlyDiagnosticIdsMethodName = "workspace/buildOnlyDiagnosticIds"; | ||
|
||
private readonly DiagnosticAnalyzerInfoCache.SharedGlobalCache _globalCache = globalCache; | ||
private readonly ImmutableDictionary<string, string[]> _compilerBuildOnlyDiagnosticIds = compilerBuildOnlyDiagnosticsProviders |
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.
nit: _languageNameToBuildOnlyDiagnosticIds
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.
lgtm.
Work towards dotnet/vscode-csharp#5728
Exposes an LSP API to fetch build-only diagnostic IDs for the given solution snapshot. This API will be invoked from VSCode C# extension on execution of explicit build/rebuild commands to separate out build-only and live diagnostics. See dotnet/vscode-csharp#5728 (comment) for details.