Skip to content

Commit 5023ecf

Browse files
fix(vscode): prompt manual reload in remote envs (#5530)
1 parent 945a6cd commit 5023ecf

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

extensions/vscode/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import * as vscode from 'vscode';
1818
import { config } from './lib/config';
1919
import { activate as activateWelcome } from './lib/welcome';
2020

21+
let needRestart = false;
22+
2123
const incompatibleExtensionIds = [
2224
'johnsoncodehk.vscode-typescript-vue-plugin',
2325
'Vue.vscode-typescript-vue-plugin',
@@ -64,6 +66,27 @@ export const { activate, deactivate } = defineExtension(async () => {
6466

6567
nextTick(() => stop());
6668

69+
if (needRestart) {
70+
if (vscode.env.remoteName) {
71+
vscode.window.showInformationMessage(
72+
'Please restart the extension host to activate Vue support in remote environments.',
73+
'Restart Extension Host',
74+
'Reload Window',
75+
).then(action => {
76+
if (action === 'Restart Extension Host') {
77+
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
78+
}
79+
else if (action === 'Reload Window') {
80+
vscode.commands.executeCommand('workbench.action.reloadWindow');
81+
}
82+
});
83+
}
84+
else {
85+
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
86+
}
87+
return;
88+
}
89+
6790
watch(() => config.server.includeLanguages, async () => {
6891
const reload = await vscode.window.showInformationMessage(
6992
'Please restart extension host to apply the new language settings.',
@@ -219,7 +242,7 @@ try {
219242
}
220243

221244
if (tsExtension.isActive) {
222-
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
245+
needRestart = true;
223246
}
224247
}
225248
catch {}

0 commit comments

Comments
 (0)