Skip to content

Commit 47e50f2

Browse files
committed
Add logic to take action name from json.
1 parent 2f9e1d3 commit 47e50f2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

client/src/commands/code_analysis.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ let resultsToDiagnostics = (
2727
file: string;
2828
range: [number, number, number, number];
2929
message: string;
30-
annotate?: { line: number; character: number; text: string };
30+
annotate?: {
31+
line: number;
32+
character: number;
33+
text: string;
34+
action: string;
35+
};
3136
}
3237
],
3338
diagnosticsResultCodeActions: DiagnosticsResultCodeActionsMap
@@ -79,13 +84,12 @@ let resultsToDiagnostics = (
7984
// position very cheap.
8085
if (item.annotate != null) {
8186
{
82-
let codeAction = new CodeAction(`Suppress dead code warning`);
87+
let { line, character, text, action } = item.annotate;
88+
let codeAction = new CodeAction(action);
8389
codeAction.kind = CodeActionKind.RefactorRewrite;
8490

8591
let codeActionEdit = new WorkspaceEdit();
8692

87-
let { line, character, text } = item.annotate;
88-
8993
// In the future, it would be cool to have an additional code action
9094
// here for automatically removing whatever the thing that's dead is.
9195
codeActionEdit.replace(

0 commit comments

Comments
 (0)