Skip to content

Commit 1f507c5

Browse files
authored
adds handling for when we have ranges and diagnostics in quick fixes (microsoft#204421)
adds handling for when we have ranges and diagnostics
1 parent 4d3db48 commit 1f507c5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ export class CodeActionController extends Disposable implements IEditorContribut
308308
const diagnostics = action.action.diagnostics;
309309
currentDecorations.clear();
310310
if (ranges && ranges.length > 0) {
311-
const decorations: IModelDeltaDecoration[] = ranges.map(range => ({ range, options: CodeActionController.DECORATION }));
311+
// Handles case for `fix all` where there are multiple diagnostics.
312+
const decorations: IModelDeltaDecoration[] = (diagnostics && diagnostics?.length > 1)
313+
? diagnostics.map(diagnostic => ({ range: diagnostic, options: CodeActionController.DECORATION }))
314+
: ranges.map(range => ({ range, options: CodeActionController.DECORATION }));
312315
currentDecorations.set(decorations);
313316
} else if (diagnostics && diagnostics.length > 0) {
314317
const decorations: IModelDeltaDecoration[] = diagnostics.map(diagnostic => ({ range: diagnostic, options: CodeActionController.DECORATION }));

0 commit comments

Comments
 (0)