diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index 91d2bc0085c..61df7b0ca43 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -183,7 +183,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient this._apiVersion = API.defaultVersion; this.tracer = new Tracer(this.logger); - this.disposables.push(workspace.onDidChangeConfiguration(() => { + workspace.onDidChangeConfiguration(() => { const oldConfiguration = this.configuration; this.configuration = TypeScriptServiceConfiguration.loadFromWorkspace(); @@ -199,7 +199,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient this.restartTsServer(); } } - })); + }, this, this.disposables); this.telemetryReporter = new TelemetryReporter(); this.disposables.push(this.telemetryReporter); this.startService(); diff --git a/extensions/typescript/src/utils/configuration.ts b/extensions/typescript/src/utils/configuration.ts index 57c5c1a641a..df3a8943643 100644 --- a/extensions/typescript/src/utils/configuration.ts +++ b/extensions/typescript/src/utils/configuration.ts @@ -71,13 +71,10 @@ export class TypeScriptServiceConfiguration { } private static extractGlobalTsdk(configuration: WorkspaceConfiguration): string | null { - let inspect = configuration.inspect('typescript.tsdk'); + const inspect = configuration.inspect('typescript.tsdk'); if (inspect && inspect.globalValue && 'string' === typeof inspect.globalValue) { return inspect.globalValue; } - if (inspect && inspect.defaultValue && 'string' === typeof inspect.defaultValue) { - return inspect.defaultValue; - } return null; } diff --git a/extensions/typescript/src/utils/versionPicker.ts b/extensions/typescript/src/utils/versionPicker.ts index 7f7270a359d..42ee8d5a6d1 100644 --- a/extensions/typescript/src/utils/versionPicker.ts +++ b/extensions/typescript/src/utils/versionPicker.ts @@ -31,7 +31,7 @@ export class TypeScriptVersionPicker { ) { this._currentVersion = this.versionProvider.defaultVersion; - if (workspaceState.get(useWorkspaceTsdkStorageKey, false)) { + if (this.useWorkspaceTsdkSetting) { const localVersion = this.versionProvider.localVersion; if (localVersion) { this._currentVersion = localVersion; @@ -39,6 +39,10 @@ export class TypeScriptVersionPicker { } } + public get useWorkspaceTsdkSetting(): boolean { + return this.workspaceState.get(useWorkspaceTsdkStorageKey, false); + } + public get currentVersion(): TypeScriptVersion { return this._currentVersion; } @@ -52,7 +56,7 @@ export class TypeScriptVersionPicker { const shippedVersion = this.versionProvider.defaultVersion; pickOptions.push({ - label: (this.currentVersion.path === shippedVersion.path + label: (!this.useWorkspaceTsdkSetting ? '• ' : '') + localize('useVSCodeVersionOption', 'Use VS Code\'s Version'), description: shippedVersion.versionString, @@ -62,7 +66,7 @@ export class TypeScriptVersionPicker { for (const version of this.versionProvider.localVersions) { pickOptions.push({ - label: (this.currentVersion.path === version.path + label: (this.useWorkspaceTsdkSetting && this.currentVersion.path === version.path ? '• ' : '') + localize('useWorkspaceVersionOption', 'Use Workspace Version'), description: version.versionString,