Miscellaneous extension improvements#3516
Conversation
| } | ||
|
|
||
| get serverPid(): number | undefined { | ||
| return (this.client as any)?._serverProcess?.pid; |
There was a problem hiding this comment.
This is unfortunate
| }); | ||
|
|
||
| // Workspace versions | ||
| if (vscode.workspace.isTrusted) { |
There was a problem hiding this comment.
The trust checks are dead code for now, because the extension doesn't activate on untrusted workspaces, but I assume that's something we'll remove by RC / stable / whenever we ship by default in VS Code.
jakebailey
left a comment
There was a problem hiding this comment.
Nice! At some point we're going to have to write the code that tries to use the regular tsdk setting, too
There was a problem hiding this comment.
Pull request overview
This PR improves the VS Code native-preview extension by adding a TypeScript version picker (with workspace opt-in persistence), surfacing debug info (PID/exe path) in the server menu, and aligning diagnostic collection ownership.
Changes:
- Add workspace-tsdk opt-in gating and persistence via workspaceState, plus a prompt to use detected workspace installs.
- Implement a version-selection quick pick (bundled/workspace/custom locations) and add optional debug info items to the server menu.
- Set the diagnostic collection name to
"typescript"and add new extension settings/command contributions.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
_extension/src/util.ts |
Adds workspace-level tsdk opt-in gating and storage key. |
_extension/src/session.ts |
Adds version picker logic, workspace-version prompt, and debug-info menu items. |
_extension/src/extension.ts |
Calls workspace-version prompt after session start. |
_extension/src/client.ts |
Sets diagnostic collection name and exposes server PID. |
_extension/package.json |
Adds settings for extra TSDK locations + debug info, and contributes a “Select Version” command. |
Version picker with persistent preference
Ports the "Select TypeScript Version" command handler from the built-in TypeScript extension, which prior to this PR results in an error if you're using the native preview. This automates setting/changing your workspace setting’s
typescript.native-preview.tsdkvalue.Like the built-in extension, upon discovering a workspace tsdk setting, we now prompt one time to ask if you want to use it, and save the preference.
A new
typescript.native-preview.additionalTsdkLocationssetting adds to the pick list. This is a selfish feature because it's always annoying as a developer working on TypeScript to swap to a workspace-installed version via the UI and then not be able to switch back to your local clone without manually typing it into the settings file. I added my local build to my user preferences so it will always show up in the UI for me.Adds PID and binary path location to server menu with a setting
If you enable
typescript.native-preview.showDebugInfo, clicking on the tsgo status item menu shows:I'm constantly guessing which
tsgoprocess to attach to for debugging. (Selecting the item copies the value to the clipboard.)Fix diagnostic collection owner name
Per request from @mjbvz