mirror of
https://github.com/Microsoft/vscode
synced 2024-10-01 08:50:48 +00:00
adds handling for when we have ranges and diagnostics in quick fixes (#204421)
adds handling for when we have ranges and diagnostics
This commit is contained in:
parent
4d3db486c2
commit
1f507c5474
|
@ -308,7 +308,10 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
const diagnostics = action.action.diagnostics;
|
||||
currentDecorations.clear();
|
||||
if (ranges && ranges.length > 0) {
|
||||
const decorations: IModelDeltaDecoration[] = ranges.map(range => ({ range, options: CodeActionController.DECORATION }));
|
||||
// Handles case for `fix all` where there are multiple diagnostics.
|
||||
const decorations: IModelDeltaDecoration[] = (diagnostics && diagnostics?.length > 1)
|
||||
? diagnostics.map(diagnostic => ({ range: diagnostic, options: CodeActionController.DECORATION }))
|
||||
: ranges.map(range => ({ range, options: CodeActionController.DECORATION }));
|
||||
currentDecorations.set(decorations);
|
||||
} else if (diagnostics && diagnostics.length > 0) {
|
||||
const decorations: IModelDeltaDecoration[] = diagnostics.map(diagnostic => ({ range: diagnostic, options: CodeActionController.DECORATION }));
|
||||
|
|
Loading…
Reference in a new issue