Skip to content

Fix configuration lookups and prefer saving as js/ts#4054

Open
DanielRosenwasser wants to merge 5 commits into
mainfrom
fixTogglingBehavior
Open

Fix configuration lookups and prefer saving as js/ts#4054
DanielRosenwasser wants to merge 5 commits into
mainfrom
fixTogglingBehavior

Conversation

@DanielRosenwasser
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser commented May 26, 2026

When modifying the useTsgo setting, we would previously modify typescript.experimental.useTsgo; however, that setting is deprecated.

Additionally, we would always prefer js/ts.experimental.useTsgo over typescript.experimental.useTsgo, even if the latter occurred in the workspace, and the former occurred in the global user settings.

And finally, we had a bug in development mode where we would always start the server if useTsgo was explicitly false.

This PR does a few things:

  • Respects specificity of options. typescript.experimental.useTsgo can now win out over js/ts.experimental.useTsgo if it was specified in the workspace, and js/ts was specified in the user settings. If both are specified in the same location, js/ts always wins out.
  • We always set the js/ts configuration when making modifications. If the user toggles the settings via our commands, we will migrate any currently-active typescript configurations, or just drop them if they coexist in the same settings location.
  • Stops immediately after issuing a warning when useTsgo === false in development mode, instead of starting up the language server.

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 updates the VS Code native-preview extension to prefer the unified js/ts.experimental.useTsgo setting when reporting or updating the useTsgo enablement flag, since typescript.experimental.useTsgo is deprecated.

Changes:

  • Update the development-mode warning to default to referencing js/ts.experimental.useTsgo.
  • Change updateUseTsgoSetting to prefer writing js/ts.experimental.useTsgo in more cases and avoid updating both settings at once.
Show a summary per file
File Description
_extension/src/extension.ts Adjusts the dev-mode warning fallback setting name to js/ts.experimental.useTsgo.
_extension/src/commands.ts Updates logic for choosing which configuration section/target to update when toggling useTsgo.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread _extension/src/commands.ts Outdated
Comment on lines 37 to 42
if (jsTsTarget !== undefined || tsTarget === undefined) {
await jsTsConfig.update("experimental.useTsgo", enable, jsTsTarget ?? vscode.ConfigurationTarget.Global);
}
if (tsTarget !== undefined || jsTsTarget === undefined) {
updates.push(tsConfig.update("experimental.useTsgo", enable, tsTarget ?? vscode.ConfigurationTarget.Global));
else if (tsTarget !== undefined) {
await tsConfig.update("experimental.useTsgo", enable, tsTarget);
}
@DanielRosenwasser DanielRosenwasser requested review from jakebailey and removed request for gabritto May 26, 2026 22:10
@DanielRosenwasser DanielRosenwasser changed the title Prefer js/ts settings when modifying useTsgo. Fix configuration lookups and prefer saving as js/ts May 26, 2026
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.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment thread _extension/src/util.ts
Comment on lines 156 to +168
export function getUseTsgo(): boolean | undefined {
const tsValue = getExplicitUseTsgo("typescript");
const jsTsValue = getExplicitUseTsgo("js/ts");
if (tsValue === true || jsTsValue === true) return true;
if (tsValue === false || jsTsValue === false) return false;

if (tsValue !== undefined || jsTsValue !== undefined) {
const jsTsTarget = getExplicitConfigTarget(vscode.workspace.getConfiguration("js/ts"), "experimental.useTsgo");
const tsTarget = getExplicitConfigTarget(vscode.workspace.getConfiguration("typescript"), "experimental.useTsgo");
const mostSpecific = Math.max(jsTsTarget ?? vscode.ConfigurationTarget.Global, tsTarget ?? vscode.ConfigurationTarget.Global);
return jsTsTarget === mostSpecific ? jsTsValue : tsValue;
}

return undefined;
}
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.

2 participants