Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .vscode/launch.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"name": "Launch VS Code extension",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extension=vscode.typescript-language-features",
"--disable-extension=ms-vscode.vscode-typescript-next",
"--extensionDevelopmentPath=${workspaceRoot}/_extension"
],
"outFiles": [
Expand Down
29 changes: 20 additions & 9 deletions _extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,30 @@ export async function activate(context: vscode.ExtensionContext) {
}));

const useTsgo = vscode.workspace.getConfiguration("typescript").get<boolean>("experimental.useTsgo");
if (!useTsgo) {
if (context.extensionMode === vscode.ExtensionMode.Development) {
if (useTsgo === false) {
vscode.window.showInformationMessage(
'TypeScript Native Preview is running in development mode. Ignoring "typescript.experimental.useTsgo": false.',
);

if (context.extensionMode === vscode.ExtensionMode.Development) {
const tsExtension = vscode.extensions.getExtension("vscode.typescript-language-features");
if (!tsExtension) {
if (!useTsgo) {
output.appendLine("TypeScript Native Preview: Built-in TypeScript extension is disabled. Using tsgo regardless of setting.");
}
}
else {
output.appendLine("TypeScript Native Preview is disabled. Select 'Enable TypeScript Native Preview (Experimental)' in the command palette to enable it.");
return;
else if (useTsgo === false) {
const selected = await vscode.window.showWarningMessage(
'TypeScript Native Preview is running in development mode with "typescript.experimental.useTsgo" set to false.',
"Enable Setting",
"Ignore",
);
if (selected === "Enable Setting") {
await vscode.commands.executeCommand("typescript.native-preview.enable");
return;
}
}
}
else if (!useTsgo) {
output.appendLine("TypeScript Native Preview is disabled. Select 'Enable TypeScript Native Preview (Experimental)' in the command palette to enable it.");
return;
}

disposeLanguageFeatures = await activateLanguageFeatures(context, output, traceOutput);
context.subscriptions.push(disposeLanguageFeatures);
Expand Down
Loading