Skip to content

Commit c01ba26

Browse files
authored
Fix TS Version Selector When Local Version == Global Version (microsoft#19593)
**Bug** When the global tsdk setting points to the workspace version of typescript, our ts selector interface can get confused on which version is currently active **Fix** Adds a check using the local storage value to show the correct active version
1 parent 15c2d1f commit c01ba26

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/typescript/src/typescriptServiceClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
498498
return Promise.resolve(modulePath);
499499
}
500500

501+
const useWorkspaceVersionSetting = this.workspaceState.get<boolean>(TypeScriptServiceClient.useWorkspaceTsdkStorageKey, false);
501502
const shippedVersion = this.getTypeScriptVersion(this.globalTypescriptPath);
502503
const localModulePath = this.localTypeScriptPath;
503504
let messageShown: Thenable<MyQuickPickItem | undefined>;
@@ -507,12 +508,12 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
507508
{
508509
label: localize('useWorkspaceVersionOption', 'Use Workspace Version'),
509510
description: localVersion || '',
510-
detail: modulePath === localModulePath ? localize('activeVersion', 'Currently active') : '',
511+
detail: modulePath === localModulePath && (modulePath !== this.globalTypescriptPath || useWorkspaceVersionSetting) ? localize('activeVersion', 'Currently active') : '',
511512
id: MessageAction.useLocal
512513
}, {
513514
label: localize('useVSCodeVersionOption', 'Use VSCode\'s Version'),
514515
description: shippedVersion || '',
515-
detail: modulePath === this.globalTypescriptPath ? localize('activeVersion', 'Currently active') : '',
516+
detail: modulePath === this.globalTypescriptPath && (modulePath !== localModulePath || !useWorkspaceVersionSetting) ? localize('activeVersion', 'Currently active') : '',
516517
id: MessageAction.useBundled,
517518
}, {
518519
label: localize('learnMore', 'Learn More'),

0 commit comments

Comments
 (0)