Skip to content

Commit 48d87b8

Browse files
committed
refactor(vscode): reorganize incompatible extension check
1 parent 0154301 commit 48d87b8

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

extensions/vscode/index.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +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-
23-
const incompatibleExtensionIds = [
24-
'johnsoncodehk.vscode-typescript-vue-plugin',
25-
'Vue.vscode-typescript-vue-plugin',
26-
];
27-
28-
for (const extensionId of incompatibleExtensionIds) {
29-
const extension = vscode.extensions.getExtension(extensionId);
30-
if (extension) {
31-
vscode.window.showErrorMessage(
32-
`The "${extensionId}" extension is incompatible with the Vue extension. Please uninstall it.`,
33-
'Show Extension',
34-
).then(action => {
35-
if (action === 'Show Extension') {
36-
vscode.commands.executeCommand('workbench.extensions.search', '@id:' + extensionId);
37-
}
38-
});
39-
}
40-
}
41-
4221
let client: lsp.BaseLanguageClient | undefined;
22+
let needRestart = false;
4323

4424
class _LanguageClient extends lsp.LanguageClient {
4525
fillInitializeParams(params: lsp.InitializeParams) {
@@ -64,6 +44,25 @@ export const { activate, deactivate } = defineExtension(() => {
6444

6545
nextTick(() => stop());
6646

47+
for (
48+
const extensionId of [
49+
'johnsoncodehk.vscode-typescript-vue-plugin',
50+
'Vue.vscode-typescript-vue-plugin',
51+
]
52+
) {
53+
const extension = vscode.extensions.getExtension(extensionId);
54+
if (extension) {
55+
vscode.window.showErrorMessage(
56+
`The "${extensionId}" extension is incompatible with the Vue extension. Please uninstall it.`,
57+
'Show Extension',
58+
).then(action => {
59+
if (action === 'Show Extension') {
60+
vscode.commands.executeCommand('workbench.extensions.search', '@id:' + extensionId);
61+
}
62+
});
63+
}
64+
}
65+
6766
if (needRestart) {
6867
vscode.window.showInformationMessage(
6968
'Please restart the extension host to activate Vue support in remote environments.',

0 commit comments

Comments
 (0)