Skip to content
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

Cherry-pick fix for code action fix all to release #7537

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/lsptoolshost/fixAllCodeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ export function registerCodeActionFixAllCommands(
}

export async function getFixAllResponse(
data: LSPAny,
data: RoslynProtocol.CodeActionResolveData,
languageServer: RoslynLanguageServer,
outputChannel: vscode.OutputChannel
) {
if (!data.FixAllFlavors) {
throw new Error(`FixAllFlavors is missing from data ${JSON.stringify(data)}`);
}

const result = await vscode.window.showQuickPick(data.FixAllFlavors, {
placeHolder: vscode.l10n.t('Pick a fix all scope'),
});
Expand All @@ -41,7 +45,7 @@ export async function getFixAllResponse(
async (_, token) => {
if (result) {
const fixAllCodeAction: RoslynProtocol.RoslynFixAllCodeAction = {
title: data.title,
title: data.UniqueIdentifier,
data: data,
scope: result,
};
Expand Down Expand Up @@ -71,7 +75,7 @@ export async function getFixAllResponse(

async function registerFixAllResolveCodeAction(
languageServer: RoslynLanguageServer,
codeActionData: any,
codeActionData: RoslynProtocol.CodeActionResolveData,
outputChannel: vscode.OutputChannel
) {
if (codeActionData) {
Expand Down
9 changes: 9 additions & 0 deletions src/lsptoolshost/roslynProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ export interface RoslynFixAllCodeAction extends CodeAction {
scope: string;
}

/**
* Should match the definition on the server side, but only the properties we require on the client side.
* https://github.com/dotnet/roslyn/blob/bd5c00e5e09de8564093f42d87fe49d4971f2e84/src/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs#L16C20-L16C41
*/
export interface CodeActionResolveData {
UniqueIdentifier: string;
FixAllFlavors?: string[];
}

export interface NamedPipeInformation {
pipeName: string;
}
Expand Down
Loading