From 362ca1d638eef676dee8977af286ba782ec55f0b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 20 Jun 2019 18:01:39 -0700 Subject: [PATCH] Also include format in the syntax commands --- .../src/tsServer/server.ts | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/extensions/typescript-language-features/src/tsServer/server.ts b/extensions/typescript-language-features/src/tsServer/server.ts index 4a19cde00e7..9fbe7e80fac 100644 --- a/extensions/typescript-language-features/src/tsServer/server.ts +++ b/extensions/typescript-language-features/src/tsServer/server.ts @@ -333,18 +333,32 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ this.semanticServer.kill(); } - private static readonly syntaxCommands = new Set(['navtree', 'getOutliningSpans', 'jsxClosingTag', 'selectionRange']); - private static readonly sharedCommands = new Set(['change', 'close', 'open', 'updateOpen', 'configure', 'configurePlugin']); + private static readonly syntaxCommands = new Set([ + 'navtree', + 'getOutliningSpans', + 'jsxClosingTag', + 'selectionRange', + 'format', + 'formatonkey', + ]); + private static readonly sharedCommands = new Set([ + 'change', + 'close', + 'open', + 'updateOpen', + 'configure', + 'configurePlugin', + ]); public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: false, lowPriority?: boolean }): undefined; public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise>; public executeImpl(command: keyof TypeScriptRequests, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise> | undefined { - if (SyntaxRoutingTsServer.syntaxCommands.has(command)) { return this.syntaxServer.executeImpl(command, args, executeInfo); } else if (SyntaxRoutingTsServer.sharedCommands.has(command)) { - this.syntaxServer.executeImpl(command, args, executeInfo); - return this.semanticServer.executeImpl(command, args, executeInfo); + // Dispatch to both server but only return from syntax one + this.semanticServer.executeImpl(command, args, executeInfo); + return this.syntaxServer.executeImpl(command, args, executeInfo); } else { return this.semanticServer.executeImpl(command, args, executeInfo); }