diff --git a/extensions/typescript/package.json b/extensions/typescript/package.json index 162ac035bd2c5db126dc475afa7ec6a62c9f2e88..db8f7b633d309e1a6fa8026cd0f68196e61b9d4a 100644 --- a/extensions/typescript/package.json +++ b/extensions/typescript/package.json @@ -74,6 +74,12 @@ "command": "^acceptSelectedSuggestion", "when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'typescript' && suggestionSupportsAcceptOnKey" }, + "commands": [ + { + "command": "typescript.reloadProjects", + "title": "TypeScript: Reload Projects" + } + ], "debuggers": [ { "type": "node", diff --git a/extensions/typescript/src/tsconfig.json b/extensions/typescript/src/tsconfig.json index 42626bc2f90e810f21d8b055893e61e84aa08cfc..1cb4fb973b0453662be40010022284249ddf2142 100644 --- a/extensions/typescript/src/tsconfig.json +++ b/extensions/typescript/src/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "noLib": true, - "target": "ES5", + "target": "es5", "module": "commonjs", - "sourceMap": true, + "sourceMap": false, "outDir": "../out" }, "exclude": [ diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts index 8faf86d1ff7531ef9a26e08e450e0759732a13a3..7303930d99ce1ed9c1f03ea9aa3225e85e17b699 100644 --- a/extensions/typescript/src/typescriptMain.ts +++ b/extensions/typescript/src/typescriptMain.ts @@ -9,7 +9,7 @@ * ------------------------------------------------------------------------------------------ */ 'use strict'; -import { languages, workspace, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range } from 'vscode'; +import { languages, commands, workspace, Uri, ExtensionContext, IndentAction, Diagnostic, DiagnosticCollection, Range } from 'vscode'; import * as Proto from './protocol'; import TypeScriptServiceClient from './typescriptServiceClient'; @@ -41,6 +41,9 @@ export function activate(context: ExtensionContext): void { client.onReady().then(() => { registerSupports(MODE_ID_TS, clientHost, client); registerSupports(MODE_ID_TSX, clientHost, client); + context.subscriptions.push(commands.registerCommand('typescript.reloadProjects', () => { + clientHost.reloadProjects(); + })); }, () => { // Nothing to do here. The client did show a message; }) @@ -166,6 +169,11 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost { return this.client; } + public reloadProjects(): void { + this.client.execute('reloadProjects', null, false); + this.triggerAllDiagnostics(); + } + public addBufferSyncSupport(support: BufferSyncSupport): void { this.bufferSyncSupports.push(support); }