From 288968f8036f6dc4bb003fcefb2d7649be33bf8d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 18 May 2017 16:07:54 -0700 Subject: [PATCH] Fix duplicate code ids names being uploaded to ts --- .../typescript/src/features/codeActionProvider.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/typescript/src/features/codeActionProvider.ts b/extensions/typescript/src/features/codeActionProvider.ts index aea55cef7ed..0a9d297987c 100644 --- a/extensions/typescript/src/features/codeActionProvider.ts +++ b/extensions/typescript/src/features/codeActionProvider.ts @@ -58,7 +58,7 @@ export default class TypeScriptCodeActionProvider implements CodeActionProvider }; return this.getSupportedActionsForContext(context) .then(supportedActions => { - if (!supportedActions.length) { + if (!supportedActions.size) { return []; } return this.client.execute('getCodeFixes', { @@ -67,8 +67,8 @@ export default class TypeScriptCodeActionProvider implements CodeActionProvider endLine: range.end.line + 1, startOffset: range.start.character + 1, endOffset: range.end.character + 1, - errorCodes: supportedActions - }, token).then(response => response.body || []); + errorCodes: Array.from(supportedActions) + } as Proto.CodeFixRequestArgs, token).then(response => response.body || []); }) .then(codeActions => codeActions.map(action => this.actionToEdit(source, action))); } @@ -87,11 +87,11 @@ export default class TypeScriptCodeActionProvider implements CodeActionProvider return this._supportedCodeActions; } - private getSupportedActionsForContext(context: CodeActionContext) { + private getSupportedActionsForContext(context: CodeActionContext): Thenable> { return this.supportedCodeActions.then(supportedActions => - context.diagnostics + new Set(context.diagnostics .map(diagnostic => +diagnostic.code) - .filter(code => supportedActions[code])); + .filter(code => supportedActions[code]))); } private actionToEdit(source: Source, action: Proto.CodeAction): Command {