Skip to content

Commit

Permalink
Add BuildOnlyDiagnosticIdsRequest type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mavasani committed Aug 11, 2023
1 parent 0a81583 commit 6a02002
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lsptoolshost/roslynLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,15 @@ export class RoslynLanguageServer {
throw new Error(`Invalid log level ${logLevel}`);
}
}

public async getBuildOnlyDiagnosticIds(token: vscode.CancellationToken): Promise<string[]> {
const response = await _languageServer.sendRequest0(RoslynProtocol.BuildOnlyDiagnosticIdsRequest.type, token);
if (response) {
return response.ids;
}

throw new Error('Unable to retrieve build-only diagnostic ids for current solution.');
}
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/lsptoolshost/roslynProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export interface ShowToastNotificationParams {
commands: Command[];
}

export interface BuildOnlyDiagnosticIdsResult {
ids: string[];
}

export namespace WorkspaceDebugConfigurationRequest {
export const method = 'workspace/debugConfiguration';
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
Expand Down Expand Up @@ -192,3 +196,9 @@ export namespace OpenProjectNotification {
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
export const type = new lsp.NotificationType<OpenProjectParams>(method);
}

export namespace BuildOnlyDiagnosticIdsRequest {
export const method = 'workspace/buildOnlyDiagnosticIds';
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
export const type = new lsp.RequestType0<BuildOnlyDiagnosticIdsResult, void>(method);
}

0 comments on commit 6a02002

Please sign in to comment.