Skip to content

Commit 827e35a

Browse files
authored
Merge pull request #7537 from dibarbet/cherry_pick_release
Cherry-pick fix for code action fix all to release
2 parents 602baeb + 2813b49 commit 827e35a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/lsptoolshost/fixAllCodeAction.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ export function registerCodeActionFixAllCommands(
2424
}
2525

2626
export async function getFixAllResponse(
27-
data: LSPAny,
27+
data: RoslynProtocol.CodeActionResolveData,
2828
languageServer: RoslynLanguageServer,
2929
outputChannel: vscode.OutputChannel
3030
) {
31+
if (!data.FixAllFlavors) {
32+
throw new Error(`FixAllFlavors is missing from data ${JSON.stringify(data)}`);
33+
}
34+
3135
const result = await vscode.window.showQuickPick(data.FixAllFlavors, {
3236
placeHolder: vscode.l10n.t('Pick a fix all scope'),
3337
});
@@ -41,7 +45,7 @@ export async function getFixAllResponse(
4145
async (_, token) => {
4246
if (result) {
4347
const fixAllCodeAction: RoslynProtocol.RoslynFixAllCodeAction = {
44-
title: data.title,
48+
title: data.UniqueIdentifier,
4549
data: data,
4650
scope: result,
4751
};
@@ -71,7 +75,7 @@ export async function getFixAllResponse(
7175

7276
async function registerFixAllResolveCodeAction(
7377
languageServer: RoslynLanguageServer,
74-
codeActionData: any,
78+
codeActionData: RoslynProtocol.CodeActionResolveData,
7579
outputChannel: vscode.OutputChannel
7680
) {
7781
if (codeActionData) {

src/lsptoolshost/roslynProtocol.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ export interface RoslynFixAllCodeAction extends CodeAction {
188188
scope: string;
189189
}
190190

191+
/**
192+
* Should match the definition on the server side, but only the properties we require on the client side.
193+
* https://github.com/dotnet/roslyn/blob/bd5c00e5e09de8564093f42d87fe49d4971f2e84/src/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs#L16C20-L16C41
194+
*/
195+
export interface CodeActionResolveData {
196+
UniqueIdentifier: string;
197+
FixAllFlavors?: string[];
198+
}
199+
191200
export interface NamedPipeInformation {
192201
pipeName: string;
193202
}

0 commit comments

Comments
 (0)