diff --git a/src/vs/editor/contrib/codeAction/codeActionTrigger.ts b/src/vs/editor/contrib/codeAction/codeActionTrigger.ts index 15e90604ed6..f0fb3b3e6bf 100644 --- a/src/vs/editor/contrib/codeAction/codeActionTrigger.ts +++ b/src/vs/editor/contrib/codeAction/codeActionTrigger.ts @@ -20,8 +20,12 @@ export class CodeActionKind { public readonly value: string ) { } + public equals(other: CodeActionKind): boolean { + return this.value === other.value; + } + public contains(other: CodeActionKind): boolean { - return this.value === other.value || startsWith(other.value, this.value + CodeActionKind.sep); + return this.equals(other) || startsWith(other.value, this.value + CodeActionKind.sep); } public intersects(other: CodeActionKind): boolean { diff --git a/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts b/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts index 768c8283037..76bed28b12e 100644 --- a/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/browser/mainThreadSaveParticipant.ts @@ -266,14 +266,18 @@ class CodeActionOnSaveParticipant implements ISaveParticipant { const codeActionsOnSave = Object.keys(setting) .filter(x => setting[x]).map(x => new CodeActionKind(x)) .sort((a, b) => { - if (a.value === CodeActionKind.SourceFixAll.value) { - return -1; - } - if (b.value === CodeActionKind.SourceFixAll.value) { + if (CodeActionKind.SourceFixAll.contains(a)) { + if (CodeActionKind.SourceFixAll.contains(b)) { + return 0; + } return 1; } + if (CodeActionKind.SourceFixAll.contains(b)) { + return -1; + } return 0; }); + if (!codeActionsOnSave.length) { return undefined; }