mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 14:31:31 +01:00
Make sure we only mark one selected TS version in the picker
Fixes #31876
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user