Skip to content

Clarify TypeScript version picker UI when workspace version is manually configured#269527

Open
magliocchetti wants to merge 2 commits intomicrosoft:mainfrom
magliocchetti:263226-fix-typescript-version-picker-indicator
Open

Clarify TypeScript version picker UI when workspace version is manually configured#269527
magliocchetti wants to merge 2 commits intomicrosoft:mainfrom
magliocchetti:263226-fix-typescript-version-picker-indicator

Conversation

@magliocchetti
Copy link
Copy Markdown
Contributor

@magliocchetti magliocchetti commented Oct 2, 2025

Summary

Fixes #263226

Improves the "TypeScript: Select TypeScript Version..." UI by adding clarifying text when there's a mismatch between the user's explicit selection and the currently active TypeScript version.

Problem

When users manually set "typescript.tsdk": "node_modules/typescript/lib" in their workspace settings (without using the version picker), the UI was confusing:

  • The "Use VS Code's Version" item showed a bullet (•) indicating it was selected
  • However, the workspace TypeScript version was actually active and running
  • There was no indication that a workspace version was currently in use

This caused confusion about which TypeScript version was being used.

Root Cause

The version picker UI was designed to show which version type the user has explicitly selected through the picker (tracked by workspace state), not which version is currently active. When users manually configure typescript.tsdk in settings.json:

  • The workspace state flag remains in "bundled selected" state
  • But the workspace TypeScript version becomes active
  • The UI showed no indication of this mismatch

Solution

Following maintainer feedback, this PR clarifies the UI rather than changing the selection indicator logic:

  • The bullet (•) continues to indicate the user's explicit selection (maintains existing behavior)
  • NEW: Adds clarifying text when there's a mismatch between selection and active version

Specific Changes

  1. Workspace version active but not selected (the reported issue):

    • Description now shows: "5.9.1 (Currently Active)"
    • Makes it clear the workspace version is running even though not explicitly selected
  2. Bundled version selected but different version active (rare edge case):

    • Description now shows: "5.8.3 (Currently Active: 5.9.1)"
    • Clarifies when there's an unexpected mismatch

Behavior

Before (confusing)

• Use VS Code's Version          5.8.3          /path/to/bundled
  Use Workspace Version          5.9.1          node_modules/typescript/lib

No indication that workspace version is actually active!

After (clear)

• Use VS Code's Version          5.8.3          /path/to/bundled
  Use Workspace Version          5.9.1 (Currently Active)          node_modules/typescript/lib

Now clearly shows workspace version is active.

Impact

Testing

Manually tested scenarios:

  1. User manually sets typescript.tsdk → workspace version shows "(Currently Active)"
  2. User selects workspace through picker → workspace version shows bullet only
  3. User selects bundled through picker → bundled version shows bullet only
  4. Edge case with version mismatch → shows both versions in description

Files Changed

  • extensions/typescript-language-features/src/tsServer/versionManager.ts

Fixes microsoft#263226

The "TypeScript: Select TypeScript Version..." command was showing
incorrect information about which TypeScript version was active when
users manually configured `typescript.tsdk` in their settings.

The issue was that the indicator logic checked the `useWorkspaceTsdkSetting`
workspace state flag (only set when selecting through the picker UI) rather
than checking which version was actually being used (`currentVersion`).

This caused the UI to show the bundled version as active even when the
workspace version was actually in use.

Changes:
- Simplified indicator logic in `getBundledPickItem()` to check
  `currentVersion.eq(bundledVersion)` instead of the state flag
- Simplified indicator logic in `getLocalPickItems()` to check
  `currentVersion.eq(version)` instead of the state flag
- Removed unnecessary workspace trust checks from indicator logic

The indicator now accurately reflects the active TypeScript version
regardless of whether it was configured manually or through the picker.

Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
Copilot AI review requested due to automatic review settings October 2, 2025 11:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the TypeScript version picker showed incorrect active version indicators when users manually configured typescript.tsdk in their workspace settings. The fix simplifies the logic to directly check which version is actually active rather than relying on UI state flags.

  • Simplified indicator logic in version picker to directly compare current version with available versions
  • Removed dependency on workspace state flag that wasn't set for manual configurations
  • Fixed mismatch between displayed active version and actually used version

Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current UI is confusing but it was actually designed to work like this. The most important info in this UI if the workspace or bundled TS version is being used

Instead of strictly checking the version, I think we should clarify the UI:

  • Still show which type of TS the user has selected (workspace vs bundled)
  • For cases where there is a mismatch between the active version and provided version, show a more detailed message. Something like Workspace version (Currently Active: 5.9 Found: 5.7)

…ly configured

Fixes microsoft#263226

When users manually configure `typescript.tsdk` in their workspace settings
(without using the version picker), the "TypeScript: Select TypeScript Version..."
command showed confusing information. The bundled version appeared selected
(with bullet indicator) even though the workspace version was actually active.

The UI was designed to show which version type the user has explicitly selected
through the picker, not which version is currently active. This caused confusion
when there was a mismatch between selection and active version.

This change adds clarifying text to the version picker to distinguish between
"selected" and "currently active" versions:

- When workspace version is active but not explicitly selected (e.g., manually
  configured in settings), shows: "5.9.1 (Currently Active)"

- When bundled version is selected but a different version is active (rare case),
  shows: "5.8.3 (Currently Active: 5.9.1)"

The bullet indicator (•) continues to show the user's explicit selection,
maintaining backward compatibility with existing UI conventions while adding
clarity about which version is actually running.

Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
@magliocchetti magliocchetti changed the title Fix TypeScript version picker showing incorrect active version indicator Clarify TypeScript version picker UI when workspace version is manually configured Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript: Select TypeScript Version... shows incorrect info

4 participants