Skip to content

Commit fba08b3

Browse files
committed
fix(vscode): do not delay the execution of restartExtensionHost
close #5544
1 parent ae8093a commit fba08b3

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

extensions/vscode/index.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class _LanguageClient extends lsp.LanguageClient {
4848
}
4949
}
5050

51-
export const { activate, deactivate } = defineExtension(async () => {
52-
await vscode.extensions.getExtension('vscode.typescript-language-features')?.activate();
53-
51+
export const { activate, deactivate } = defineExtension(() => {
5452
const context = extensionContext.value!;
5553
const volarLabs = createLabsInfo();
5654
const activeTextEditor = useActiveTextEditor();
@@ -67,23 +65,18 @@ export const { activate, deactivate } = defineExtension(async () => {
6765
nextTick(() => stop());
6866

6967
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-
}
68+
vscode.window.showInformationMessage(
69+
'Please restart the extension host to activate Vue support in remote environments.',
70+
'Restart Extension Host',
71+
'Reload Window',
72+
).then(action => {
73+
if (action === 'Restart Extension Host') {
74+
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
75+
}
76+
else if (action === 'Reload Window') {
77+
vscode.commands.executeCommand('workbench.action.reloadWindow');
78+
}
79+
});
8780
return;
8881
}
8982

@@ -245,7 +238,12 @@ try {
245238
}
246239

247240
if (tsExtension.isActive) {
248-
needRestart = true;
241+
if (!vscode.env.remoteName) {
242+
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
243+
}
244+
else {
245+
needRestart = true;
246+
}
249247
}
250248
}
251249
catch {}

0 commit comments

Comments
 (0)