Skip to content

Commit be69969

Browse files
authored
Merge branch 'vuejs:master' into master
2 parents c67eeaa + bef4f47 commit be69969

File tree

81 files changed

+3763
-4028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3763
-4028
lines changed

extensions/vscode/package.json

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "volar",
4-
"version": "2.2.8",
4+
"version": "3.0.0-alpha.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/vuejs/language-tools.git",
@@ -254,34 +254,6 @@
254254
"default": "off",
255255
"description": "Traces the communication between VS Code and the language server."
256256
},
257-
"vue.server.hybridMode": {
258-
"type": [
259-
"boolean",
260-
"string"
261-
],
262-
"default": "auto",
263-
"enum": [
264-
"auto",
265-
"typeScriptPluginOnly",
266-
true,
267-
false
268-
],
269-
"enumDescriptions": [
270-
"Automatically detect and enable TypeScript Plugin/Hybrid Mode in a safe environment.",
271-
"Only enable Vue TypeScript Plugin but disable Hybrid Mode.",
272-
"Enable TypeScript Plugin/Hybrid Mode.",
273-
"Disable TypeScript Plugin/Hybrid Mode."
274-
],
275-
"description": "Vue language server only handles CSS and HTML language support, and tsserver takes over TS language support via TS plugin."
276-
},
277-
"vue.server.compatibleExtensions": {
278-
"type": "array",
279-
"items": {
280-
"type": "string"
281-
},
282-
"default": [],
283-
"description": "Set compatible extensions to skip automatic detection of Hybrid Mode."
284-
},
285257
"vue.server.includeLanguages": {
286258
"type": "array",
287259
"items": {
@@ -291,14 +263,6 @@
291263
"vue"
292264
]
293265
},
294-
"vue.server.maxOldSpaceSize": {
295-
"type": [
296-
"number",
297-
"null"
298-
],
299-
"default": null,
300-
"description": "Set --max-old-space-size option on server process. If you have problem on frequently \"Request textDocument/** failed.\" error, try setting higher memory(MB) on it."
301-
},
302266
"vue.doctor.status": {
303267
"type": "boolean",
304268
"default": true,
@@ -330,11 +294,6 @@
330294
"customBlocks"
331295
]
332296
},
333-
"vue.updateImportsOnFileMove.enabled": {
334-
"type": "boolean",
335-
"default": true,
336-
"description": "Enabled update imports on file move."
337-
},
338297
"vue.codeActions.enabled": {
339298
"type": "boolean",
340299
"default": true,
@@ -462,66 +421,47 @@
462421
"title": "Doctor",
463422
"category": "Vue"
464423
},
465-
{
466-
"command": "vue.action.writeVirtualFiles",
467-
"title": "Write Virtual Files",
468-
"category": "Vue (Debug)"
469-
},
470424
{
471425
"command": "vue.action.splitEditors",
472426
"title": "Split <script>, <template>, <style> Editors",
473427
"category": "Vue",
474428
"icon": "images/split-editors.png"
475-
},
476-
{
477-
"command": "vue.findAllFileReferences",
478-
"title": "Find File References via Vue Language Server",
479-
"category": "Vue"
480429
}
481430
],
482431
"menus": {
483432
"editor/context": [
484433
{
485434
"command": "typescript.goToSourceDefinition",
486-
"when": "vueHybridMode && tsSupportsSourceDefinition && resourceLangId == vue",
435+
"when": "tsSupportsSourceDefinition && resourceLangId == vue",
487436
"group": "navigation@9"
488437
}
489438
],
490439
"explorer/context": [
491440
{
492441
"command": "typescript.findAllFileReferences",
493-
"when": "vueHybridMode && tsSupportsFileReferences && resourceLangId == vue",
494-
"group": "4_search"
495-
},
496-
{
497-
"command": "vue.findAllFileReferences",
498-
"when": "!vueHybridMode && resourceLangId == vue",
442+
"when": "tsSupportsFileReferences && resourceLangId == vue",
499443
"group": "4_search"
500444
}
501445
],
502446
"editor/title/context": [
503447
{
504448
"command": "typescript.findAllFileReferences",
505-
"when": "vueHybridMode && tsSupportsFileReferences && resourceLangId == vue"
449+
"when": "tsSupportsFileReferences && resourceLangId == vue"
506450
}
507451
],
508452
"commandPalette": [
509453
{
510454
"command": "typescript.reloadProjects",
511-
"when": "vueHybridMode && editorLangId == vue && typescript.isManagedFile"
455+
"when": "editorLangId == vue && typescript.isManagedFile"
512456
},
513457
{
514458
"command": "typescript.goToProjectConfig",
515-
"when": "vueHybridMode && editorLangId == vue"
459+
"when": "editorLangId == vue"
516460
},
517461
{
518462
"command": "vue.action.doctor",
519463
"when": "vue.activated"
520464
},
521-
{
522-
"command": "vue.action.writeVirtualFiles",
523-
"when": "vue.activated"
524-
},
525465
{
526466
"command": "vue.action.splitEditors",
527467
"when": "editorLangId == vue"
@@ -567,9 +507,9 @@
567507
"@types/vscode": "^1.82.0",
568508
"@volar/vscode": "~2.4.11",
569509
"@vscode/vsce": "^3.2.1",
570-
"@vue/language-core": "2.2.8",
571-
"@vue/language-server": "2.2.8",
572-
"@vue/typescript-plugin": "2.2.8",
510+
"@vue/language-core": "3.0.0-alpha.0",
511+
"@vue/language-server": "3.0.0-alpha.0",
512+
"@vue/typescript-plugin": "3.0.0-alpha.0",
573513
"esbuild": "^0.25.0",
574514
"esbuild-visualizer": "^0.7.0",
575515
"reactive-vscode": "^0.2.9",

extensions/vscode/src/compatibility.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

extensions/vscode/src/hybridMode.ts

Lines changed: 25 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,8 @@
11
import * as fs from 'node:fs';
22
import * as path from 'node:path';
3-
import { computed, executeCommand, useAllExtensions, useVscodeContext, watchEffect } from 'reactive-vscode';
3+
import { computed, useAllExtensions } from 'reactive-vscode';
44
import * as semver from 'semver';
55
import * as vscode from 'vscode';
6-
import { incompatibleExtensions, unknownExtensions } from './compatibility';
7-
import { config } from './config';
8-
9-
const extensions = useAllExtensions();
10-
11-
export const enabledHybridMode = computed(() => {
12-
if (config.server.hybridMode === 'typeScriptPluginOnly') {
13-
return false;
14-
}
15-
else if (config.server.hybridMode === 'auto') {
16-
if (
17-
incompatibleExtensions.value.length ||
18-
unknownExtensions.value.length
19-
) {
20-
return false;
21-
}
22-
else if (
23-
(vscodeTsdkVersion.value && !semver.gte(vscodeTsdkVersion.value, '5.3.0')) ||
24-
(workspaceTsdkVersion.value && !semver.gte(workspaceTsdkVersion.value, '5.3.0'))
25-
) {
26-
return false;
27-
}
28-
return true;
29-
}
30-
return config.server.hybridMode;
31-
});
32-
33-
export const enabledTypeScriptPlugin = computed(() => {
34-
return (
35-
enabledHybridMode.value ||
36-
config.server.hybridMode === 'typeScriptPluginOnly'
37-
);
38-
});
396

407
const vscodeTsdkVersion = computed(() => {
418
const nightly = extensions.value.find(
@@ -68,107 +35,33 @@ const workspaceTsdkVersion = computed(() => {
6835
}
6936
});
7037

71-
export function useHybridModeTips() {
72-
useVscodeContext('vueHybridMode', enabledHybridMode);
38+
const extensions = useAllExtensions();
7339

74-
watchEffect(() => {
75-
if (config.server.hybridMode === 'auto') {
76-
if (
77-
incompatibleExtensions.value.length ||
78-
unknownExtensions.value.length
79-
) {
80-
vscode.window
81-
.showInformationMessage(
82-
`Hybrid Mode is disabled automatically because there is a potentially incompatible ${[
83-
...incompatibleExtensions.value,
84-
...unknownExtensions.value,
85-
].join(', ')} TypeScript plugin installed.`,
86-
'Open Settings',
87-
'Report a false positive'
88-
)
89-
.then(value => {
90-
if (value === 'Open Settings') {
91-
executeCommand(
92-
'workbench.action.openSettings',
93-
'vue.server.hybridMode'
94-
);
95-
}
96-
else if (value == 'Report a false positive') {
97-
vscode.env.openExternal(
98-
vscode.Uri.parse(
99-
'https://github.com/vuejs/language-tools/pull/4206'
100-
)
101-
);
102-
}
103-
});
104-
}
105-
else if (
106-
(vscodeTsdkVersion.value && !semver.gte(vscodeTsdkVersion.value, '5.3.0')) ||
107-
(workspaceTsdkVersion.value && !semver.gte(workspaceTsdkVersion.value, '5.3.0'))
108-
) {
109-
let msg = `Hybrid Mode is disabled automatically because TSDK >= 5.3.0 is required (VSCode TSDK: ${vscodeTsdkVersion.value}`;
110-
if (workspaceTsdkVersion.value) {
111-
msg += `, Workspace TSDK: ${workspaceTsdkVersion.value}`;
112-
}
113-
msg += `).`;
114-
vscode.window
115-
.showInformationMessage(msg, 'Open Settings')
116-
.then(value => {
117-
if (value === 'Open Settings') {
118-
executeCommand(
119-
'workbench.action.openSettings',
120-
'vue.server.hybridMode'
121-
);
122-
}
123-
});
124-
}
40+
export function checkCompatible() {
41+
for (const extension of extensions.value) {
42+
if (
43+
extension.id === 'denoland.vscode-deno'
44+
&& vscode.workspace.getConfiguration('deno').get<boolean>('enable')
45+
) {
46+
vscode.window.showWarningMessage(`The ${extension.packageJSON.displayName}(${extension.id}) extension is incompatible with the Vue extension. Please disable Deno in workspace to avoid issues.`);
12547
}
126-
else if (config.server.hybridMode && incompatibleExtensions.value.length) {
127-
vscode.window
128-
.showWarningMessage(
129-
`You have explicitly enabled Hybrid Mode, but you have installed known incompatible extensions: ${incompatibleExtensions.value.join(
130-
', '
131-
)}. You may want to change vue.server.hybridMode to "auto" to avoid compatibility issues.`,
132-
'Open Settings',
133-
'Report a false positive'
134-
)
135-
.then(value => {
136-
if (value === 'Open Settings') {
137-
executeCommand(
138-
'workbench.action.openSettings',
139-
'vue.server.hybridMode'
140-
);
141-
}
142-
else if (value == 'Report a false positive') {
143-
vscode.env.openExternal(
144-
vscode.Uri.parse(
145-
'https://github.com/vuejs/language-tools/pull/4206'
146-
)
147-
);
148-
}
149-
});
48+
if (
49+
extension.id === 'svelte.svelte-vscode'
50+
&& semver.lt(extension.packageJSON.version, '108.4.0')
51+
) {
52+
vscode.window.showWarningMessage(`The ${extension.packageJSON.displayName}(${extension.id}) extension is incompatible with the Vue extension. Please update ${extension.packageJSON.displayName} to the latest version to avoid issues.`);
15053
}
151-
});
152-
}
153-
154-
export function useHybridModeStatusItem() {
155-
const item = vscode.languages.createLanguageStatusItem(
156-
'vue-hybrid-mode',
157-
config.server.includeLanguages
158-
);
159-
160-
item.text = 'Hybrid Mode';
161-
item.detail =
162-
(enabledHybridMode.value ? 'Enabled' : 'Disabled') +
163-
(config.server.hybridMode === 'auto' ? ' (Auto)' : '');
164-
item.command = {
165-
title: 'Open Setting',
166-
command: 'workbench.action.openSettings',
167-
arguments: ['vue.server.hybridMode'],
168-
};
169-
170-
if (!enabledHybridMode.value) {
171-
item.severity = vscode.LanguageStatusSeverity.Warning;
54+
}
55+
if (
56+
(vscodeTsdkVersion.value && !semver.gte(vscodeTsdkVersion.value, '5.3.0')) ||
57+
(workspaceTsdkVersion.value && !semver.gte(workspaceTsdkVersion.value, '5.3.0'))
58+
) {
59+
let msg = `TSDK >= 5.3.0 is required (VSCode TSDK: ${vscodeTsdkVersion.value}`;
60+
if (workspaceTsdkVersion.value) {
61+
msg += `, Workspace TSDK: ${workspaceTsdkVersion.value}`;
62+
}
63+
msg += `).`;
64+
vscode.window.showWarningMessage(msg);
17265
}
17366
}
17467

0 commit comments

Comments
 (0)