Make sure we only mark one selected TS version in the picker

Fixes #31876
This commit is contained in:
Matt Bierner
2017-08-02 12:55:45 -07:00
parent 1b399814a3
commit 6a49783e8e
3 changed files with 10 additions and 9 deletions

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -31,7 +31,7 @@ export class TypeScriptVersionPicker {
) {
this._currentVersion = this.versionProvider.defaultVersion;
if (workspaceState.get<boolean>(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<boolean>(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,