Skip to content

Commit 2aa783c

Browse files
committed
fix(vscode): remove restartExtensionHost command usage
1 parent 2fa5905 commit 2aa783c

File tree

3 files changed

+4
-44
lines changed

3 files changed

+4
-44
lines changed

extensions/vscode/index.ts

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { config } from './lib/config';
1919
import { activate as activateWelcome } from './lib/welcome';
2020

2121
let client: lsp.BaseLanguageClient | undefined;
22-
let needRestart = false;
2322

2423
export const { activate, deactivate } = defineExtension(() => {
2524
const context = extensionContext.value!;
@@ -56,22 +55,6 @@ export const { activate, deactivate } = defineExtension(() => {
5655
}
5756
}
5857

59-
if (needRestart) {
60-
vscode.window.showInformationMessage(
61-
'Please restart the extension host to activate Vue support in remote environments.',
62-
'Restart Extension Host',
63-
'Reload Window',
64-
).then(action => {
65-
if (action === 'Restart Extension Host') {
66-
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
67-
}
68-
else if (action === 'Reload Window') {
69-
vscode.commands.executeCommand('workbench.action.reloadWindow');
70-
}
71-
});
72-
return;
73-
}
74-
7558
watch(() => config.server.includeLanguages, async () => {
7659
const reload = await vscode.window.showInformationMessage(
7760
'Please restart extension host to apply the new language settings.',
@@ -172,7 +155,9 @@ function launch(context: vscode.ExtensionContext) {
172155
return client;
173156
}
174157

175-
try {
158+
patchTypescriptExtension();
159+
160+
function patchTypescriptExtension() {
176161
const fs = require('node:fs');
177162
const tsExtension = vscode.extensions.getExtension('vscode.typescript-language-features')!;
178163
const readFileSync = fs.readFileSync;
@@ -221,21 +206,4 @@ try {
221206
}
222207
return readFileSync(...args);
223208
};
224-
225-
const loadedModule = require.cache[extensionJsPath];
226-
if (loadedModule) {
227-
delete require.cache[extensionJsPath];
228-
const patchedModule = require(extensionJsPath);
229-
Object.assign(loadedModule.exports, patchedModule);
230-
}
231-
232-
if (tsExtension.isActive) {
233-
if (!vscode.env.remoteName) {
234-
vscode.commands.executeCommand('workbench.action.restartExtensionHost');
235-
}
236-
else {
237-
needRestart = true;
238-
}
239-
}
240209
}
241-
catch {}

extensions/vscode/languages/stub.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

extensions/vscode/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
"vscode": "^1.88.0"
2323
},
2424
"activationEvents": [
25-
"onLanguage:vue",
26-
"onLanguage:markdown",
27-
"onLanguage:html"
25+
"onLanguage"
2826
],
2927
"main": "./dist/extension.js",
3028
"browser": "./web.js",
@@ -67,11 +65,6 @@
6765
{
6866
"id": "jade",
6967
"configuration": "./languages/sfc-template-language-configuration.json"
70-
},
71-
{
72-
"id": "plaintext",
73-
"configuration": "./languages/stub.json",
74-
"//": "Make sure Vue extension is loaded immediately when VSCode starts."
7568
}
7669
],
7770
"typescriptServerPlugins": [

0 commit comments

Comments
 (0)