@vue/language-service 2.0.23-alpha.1 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +8 -0
- package/index.js +10 -6
- package/lib/plugins/vue-autoinsert-dotvalue.js +1 -1
- package/lib/plugins/vue-document-drop.js +3 -3
- package/lib/plugins/vue-sfc.js +22 -0
- package/lib/plugins/vue-template.js +6 -6
- package/package.json +16 -16
package/index.d.ts
CHANGED
|
@@ -3,6 +3,14 @@ export * from '@vue/language-core';
|
|
|
3
3
|
export * from './lib/ideFeatures/nameCasing';
|
|
4
4
|
export * from './lib/types';
|
|
5
5
|
import type { LanguageServicePlugin } from '@volar/language-service';
|
|
6
|
+
import { VueCompilerOptions } from '@vue/language-core';
|
|
7
|
+
declare module '@volar/language-service' {
|
|
8
|
+
interface ProjectContext {
|
|
9
|
+
vue?: {
|
|
10
|
+
compilerOptions: VueCompilerOptions;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
6
14
|
export declare function getFullLanguageServicePlugins(ts: typeof import('typescript')): LanguageServicePlugin[];
|
|
7
15
|
export declare function getHybridModeLanguageServicePlugins(ts: typeof import('typescript'), getTsPluginClient: typeof import("@vue/typescript-plugin/lib/client")): LanguageServicePlugin[];
|
|
8
16
|
export declare const commands: {
|
package/index.js
CHANGED
|
@@ -62,12 +62,16 @@ function getFullLanguageServicePlugins(ts) {
|
|
|
62
62
|
...plugin,
|
|
63
63
|
create(context) {
|
|
64
64
|
const created = plugin.create(context);
|
|
65
|
-
if (!context.
|
|
65
|
+
if (!context.project.typescript) {
|
|
66
66
|
return created;
|
|
67
67
|
}
|
|
68
68
|
const languageService = created.provide['typescript/languageService']();
|
|
69
|
-
if (context.
|
|
70
|
-
(0, common_1.
|
|
69
|
+
if (context.project.vue) {
|
|
70
|
+
const proxy = (0, common_1.proxyLanguageServiceForVue)(ts, context.language, languageService, context.project.vue.compilerOptions, context.project.typescript.asUri);
|
|
71
|
+
languageService.getCompletionsAtPosition = proxy.getCompletionsAtPosition;
|
|
72
|
+
languageService.getCompletionEntryDetails = proxy.getCompletionEntryDetails;
|
|
73
|
+
languageService.getCodeFixesAtPosition = proxy.getCodeFixesAtPosition;
|
|
74
|
+
languageService.getQuickInfoAtPosition = proxy.getQuickInfoAtPosition;
|
|
71
75
|
}
|
|
72
76
|
return created;
|
|
73
77
|
},
|
|
@@ -77,7 +81,7 @@ function getFullLanguageServicePlugins(ts) {
|
|
|
77
81
|
}
|
|
78
82
|
return plugins;
|
|
79
83
|
function getTsPluginClientForLSP(context) {
|
|
80
|
-
if (!context.
|
|
84
|
+
if (!context.project.typescript) {
|
|
81
85
|
return;
|
|
82
86
|
}
|
|
83
87
|
const languageService = context.inject('typescript/languageService');
|
|
@@ -88,9 +92,9 @@ function getFullLanguageServicePlugins(ts) {
|
|
|
88
92
|
typescript: ts,
|
|
89
93
|
language: context.language,
|
|
90
94
|
languageService,
|
|
91
|
-
languageServiceHost: context.
|
|
95
|
+
languageServiceHost: context.project.typescript.languageServiceHost,
|
|
92
96
|
isTsPlugin: false,
|
|
93
|
-
getFileId: context.
|
|
97
|
+
getFileId: context.project.typescript.asUri,
|
|
94
98
|
};
|
|
95
99
|
return {
|
|
96
100
|
async collectExtractProps(...args) {
|
|
@@ -56,7 +56,7 @@ function create(ts, getTsPluginClient) {
|
|
|
56
56
|
}
|
|
57
57
|
let ast;
|
|
58
58
|
let sourceCodeOffset = document.offsetAt(selection);
|
|
59
|
-
const fileName = context.
|
|
59
|
+
const fileName = context.project.typescript?.asFileName(sourceScript.id)
|
|
60
60
|
?? sourceScript.id.fsPath.replace(/\\/g, '/');
|
|
61
61
|
if (sourceScript.generated) {
|
|
62
62
|
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(sourceScript.generated.root);
|
|
@@ -15,12 +15,12 @@ function create(ts, getTsPluginClient) {
|
|
|
15
15
|
// documentDropEditsProvider: true,
|
|
16
16
|
},
|
|
17
17
|
create(context) {
|
|
18
|
-
if (!context.
|
|
18
|
+
if (!context.project.vue) {
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
21
|
let casing = types_1.TagNameCasing.Pascal; // TODO
|
|
22
22
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
23
|
-
const vueCompilerOptions = context.
|
|
23
|
+
const vueCompilerOptions = context.project.vue.compilerOptions;
|
|
24
24
|
return {
|
|
25
25
|
async provideDocumentDropEdits(document, _position, dataTransfer) {
|
|
26
26
|
if (document.languageId !== 'html') {
|
|
@@ -53,7 +53,7 @@ function create(ts, getTsPluginClient) {
|
|
|
53
53
|
const additionalEdit = {};
|
|
54
54
|
const code = [...(0, language_core_1.forEachEmbeddedCode)(vueVirtualCode)].find(code => code.id === (sfc.scriptSetup ? 'scriptsetup_raw' : 'script_raw'));
|
|
55
55
|
const lastImportNode = (0, vue_extract_file_1.getLastImportNode)(ts, script.ast);
|
|
56
|
-
const incomingFileName = context.
|
|
56
|
+
const incomingFileName = context.project.typescript?.asFileName(vscode_uri_1.URI.parse(importUri))
|
|
57
57
|
?? vscode_uri_1.URI.parse(importUri).fsPath.replace(/\\/g, '/');
|
|
58
58
|
let importPath;
|
|
59
59
|
const serviceScript = sourceScript.generated?.languagePlugin.typescript?.getServiceScript(vueVirtualCode);
|
package/lib/plugins/vue-sfc.js
CHANGED
|
@@ -154,6 +154,18 @@ function create() {
|
|
|
154
154
|
return result;
|
|
155
155
|
});
|
|
156
156
|
},
|
|
157
|
+
async provideCompletionItems(document, position, context, token) {
|
|
158
|
+
const result = await htmlPluginInstance.provideCompletionItems?.(document, position, context, token);
|
|
159
|
+
if (!result) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
result.items = [
|
|
163
|
+
...result.items.filter(item => item.label !== '!DOCTYPE' && item.label !== 'Custom Blocks'),
|
|
164
|
+
createCompletionItemWithTs(result.items.find(item => item.label === 'script')),
|
|
165
|
+
createCompletionItemWithTs(result.items.find(item => item.label === 'script setup')),
|
|
166
|
+
];
|
|
167
|
+
return result;
|
|
168
|
+
},
|
|
157
169
|
};
|
|
158
170
|
},
|
|
159
171
|
};
|
|
@@ -166,4 +178,14 @@ function create() {
|
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
}
|
|
181
|
+
function createCompletionItemWithTs(base) {
|
|
182
|
+
return {
|
|
183
|
+
...base,
|
|
184
|
+
label: base.label + ' lang="ts"',
|
|
185
|
+
textEdit: {
|
|
186
|
+
...base.textEdit,
|
|
187
|
+
newText: base.textEdit.newText + ' lang="ts"',
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
169
191
|
//# sourceMappingURL=vue-sfc.js.map
|
|
@@ -111,10 +111,10 @@ function create(mode, ts, getTsPluginClient) {
|
|
|
111
111
|
if (!isSupportedDocument(document)) {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
if (!context.
|
|
114
|
+
if (!context.project.vue) {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
const vueCompilerOptions = context.
|
|
117
|
+
const vueCompilerOptions = context.project.vue.compilerOptions;
|
|
118
118
|
let sync;
|
|
119
119
|
let currentVersion;
|
|
120
120
|
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
@@ -141,10 +141,10 @@ function create(mode, ts, getTsPluginClient) {
|
|
|
141
141
|
if (!isSupportedDocument(document)) {
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
if (!context.
|
|
144
|
+
if (!context.project.vue) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
const vueCompilerOptions = context.
|
|
147
|
+
const vueCompilerOptions = context.project.vue.compilerOptions;
|
|
148
148
|
const enabled = await context.env.getConfiguration?.('vue.inlayHints.missingProps') ?? false;
|
|
149
149
|
if (!enabled) {
|
|
150
150
|
return;
|
|
@@ -305,10 +305,10 @@ function create(mode, ts, getTsPluginClient) {
|
|
|
305
305
|
if (!isSupportedDocument(document)) {
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
if (!context.
|
|
308
|
+
if (!context.project.vue) {
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
const vueCompilerOptions = context.
|
|
311
|
+
const vueCompilerOptions = context.project.vue.compilerOptions;
|
|
312
312
|
const languageService = context.inject('typescript/languageService');
|
|
313
313
|
if (!languageService) {
|
|
314
314
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~2.4.0-alpha.
|
|
20
|
-
"@volar/language-service": "~2.4.0-alpha.
|
|
21
|
-
"@volar/typescript": "~2.4.0-alpha.
|
|
19
|
+
"@volar/language-core": "~2.4.0-alpha.2",
|
|
20
|
+
"@volar/language-service": "~2.4.0-alpha.2",
|
|
21
|
+
"@volar/typescript": "~2.4.0-alpha.2",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.24",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
-
"@vue/typescript-plugin": "2.0.
|
|
25
|
+
"@vue/typescript-plugin": "2.0.24",
|
|
26
26
|
"computeds": "^0.0.1",
|
|
27
27
|
"path-browserify": "^1.0.1",
|
|
28
|
-
"volar-service-css": "0.0.
|
|
29
|
-
"volar-service-emmet": "0.0.
|
|
30
|
-
"volar-service-html": "0.0.
|
|
31
|
-
"volar-service-json": "0.0.
|
|
32
|
-
"volar-service-pug": "0.0.
|
|
33
|
-
"volar-service-pug-beautify": "0.0.
|
|
34
|
-
"volar-service-typescript": "0.0.
|
|
35
|
-
"volar-service-typescript-twoslash-queries": "0.0.
|
|
28
|
+
"volar-service-css": "0.0.56",
|
|
29
|
+
"volar-service-emmet": "0.0.56",
|
|
30
|
+
"volar-service-html": "0.0.56",
|
|
31
|
+
"volar-service-json": "0.0.56",
|
|
32
|
+
"volar-service-pug": "0.0.56",
|
|
33
|
+
"volar-service-pug-beautify": "0.0.56",
|
|
34
|
+
"volar-service-typescript": "0.0.56",
|
|
35
|
+
"volar-service-typescript-twoslash-queries": "0.0.56",
|
|
36
36
|
"vscode-html-languageservice": "^5.2.0",
|
|
37
37
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
38
38
|
"vscode-uri": "^3.0.8"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "latest",
|
|
42
42
|
"@types/path-browserify": "latest",
|
|
43
|
-
"@volar/kit": "~2.4.0-alpha.
|
|
43
|
+
"@volar/kit": "~2.4.0-alpha.2",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "bca79db09e413ef29c17b910271c123a7a68806f"
|
|
47
47
|
}
|