diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json index e4271e658c..96c158a609 100644 --- a/.vscode/launch.template.json +++ b/.vscode/launch.template.json @@ -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": [ diff --git a/_extension/src/extension.ts b/_extension/src/extension.ts index d1fe6036eb..2cfe44d603 100644 --- a/_extension/src/extension.ts +++ b/_extension/src/extension.ts @@ -45,19 +45,33 @@ export async function activate(context: vscode.ExtensionContext) { })); const useTsgo = vscode.workspace.getConfiguration("typescript").get("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) { + vscode.window.showWarningMessage( + "The built-in TypeScript extension is disabled. Sync launch.json with launch.template.json to reenable.", + "OK", ); } } - 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) { + vscode.window.showWarningMessage( + 'TypeScript Native Preview is running in development mode with "typescript.experimental.useTsgo" set to false.', + "Enable Setting", + "Ignore", + ).then(selected => { + if (selected === "Enable Setting") { + vscode.commands.executeCommand("typescript.native-preview.enable"); + } + }); } } + 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);