@vue/language-service 2.0.4 → 2.0.6
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/lib/plugins/vue-sfc.js
CHANGED
|
@@ -142,7 +142,6 @@ function create() {
|
|
|
142
142
|
...formatSettings,
|
|
143
143
|
unformatted: '',
|
|
144
144
|
contentUnformatted: blockTypes.join(','),
|
|
145
|
-
extraLiners: blockTypes.join(','),
|
|
146
145
|
endWithNewline: options.insertFinalNewline ? true
|
|
147
146
|
: options.trimFinalNewlines ? false
|
|
148
147
|
: document.getText().endsWith('\n'),
|
|
@@ -9,10 +9,12 @@ const html = require("vscode-html-languageservice");
|
|
|
9
9
|
const nameCasing_1 = require("../ideFeatures/nameCasing");
|
|
10
10
|
const types_1 = require("../types");
|
|
11
11
|
const data_1 = require("./data");
|
|
12
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
12
13
|
let builtInData;
|
|
13
14
|
let modelData;
|
|
14
15
|
function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
15
16
|
let customData = [];
|
|
17
|
+
let extraCustomData = [];
|
|
16
18
|
const onDidChangeCustomDataListeners = new Set();
|
|
17
19
|
const onDidChangeCustomData = (listener) => {
|
|
18
20
|
onDidChangeCustomDataListeners.add(listener);
|
|
@@ -25,7 +27,10 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
25
27
|
const baseServicePlugin = mode === 'pug' ? volar_service_pug_1.create : volar_service_html_1.create;
|
|
26
28
|
const baseService = baseServicePlugin({
|
|
27
29
|
getCustomData() {
|
|
28
|
-
return
|
|
30
|
+
return [
|
|
31
|
+
...customData,
|
|
32
|
+
...extraCustomData,
|
|
33
|
+
];
|
|
29
34
|
},
|
|
30
35
|
onDidChangeCustomData,
|
|
31
36
|
});
|
|
@@ -68,8 +73,14 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
68
73
|
propModifiers[name] = disc;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
76
|
+
const disposable = context.env.onDidChangeConfiguration?.(() => initializing = undefined);
|
|
77
|
+
let initializing;
|
|
71
78
|
return {
|
|
72
79
|
...baseServiceInstance,
|
|
80
|
+
dispose() {
|
|
81
|
+
baseServiceInstance.dispose?.();
|
|
82
|
+
disposable?.dispose();
|
|
83
|
+
},
|
|
73
84
|
async provideCompletionItems(document, position, completionContext, token) {
|
|
74
85
|
if (!isSupportedDocument(document))
|
|
75
86
|
return;
|
|
@@ -195,7 +206,7 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
195
206
|
if (!isSupportedDocument(document))
|
|
196
207
|
return;
|
|
197
208
|
if (context.documents.getVirtualCodeByUri(document.uri)[0])
|
|
198
|
-
|
|
209
|
+
updateExtraCustomData([]);
|
|
199
210
|
return baseServiceInstance.provideHover?.(document, position, token);
|
|
200
211
|
},
|
|
201
212
|
async provideDiagnostics(document, token) {
|
|
@@ -244,6 +255,7 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
244
255
|
},
|
|
245
256
|
};
|
|
246
257
|
async function provideHtmlData(sourceDocumentUri, vueCode) {
|
|
258
|
+
await (initializing ??= initialize());
|
|
247
259
|
const casing = await (0, nameCasing_1.getNameCasing)(context, sourceDocumentUri, tsPluginClient);
|
|
248
260
|
if (builtInData.tags) {
|
|
249
261
|
for (const tag of builtInData.tags) {
|
|
@@ -266,7 +278,7 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
266
278
|
let version = 0;
|
|
267
279
|
let components;
|
|
268
280
|
let templateContextProps;
|
|
269
|
-
|
|
281
|
+
updateExtraCustomData([
|
|
270
282
|
html.newHTMLDataProvider('vue-template-built-in', builtInData),
|
|
271
283
|
{
|
|
272
284
|
getId: () => 'vue-template',
|
|
@@ -537,7 +549,28 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
537
549
|
item.sortText = '\u0001' + (item.sortText ?? item.label);
|
|
538
550
|
}
|
|
539
551
|
}
|
|
540
|
-
|
|
552
|
+
updateExtraCustomData([]);
|
|
553
|
+
}
|
|
554
|
+
async function initialize() {
|
|
555
|
+
customData = await getHtmlCustomData();
|
|
556
|
+
}
|
|
557
|
+
async function getHtmlCustomData() {
|
|
558
|
+
const customData = await context.env.getConfiguration?.('html.customData') ?? [];
|
|
559
|
+
const newData = [];
|
|
560
|
+
for (const customDataPath of customData) {
|
|
561
|
+
const uri = vscode_uri_1.Utils.resolvePath(vscode_uri_1.URI.parse(context.env.workspaceFolder), customDataPath);
|
|
562
|
+
const json = await context.env.fs?.readFile?.(uri.toString());
|
|
563
|
+
if (json) {
|
|
564
|
+
try {
|
|
565
|
+
const data = JSON.parse(json);
|
|
566
|
+
newData.push(html.newHTMLDataProvider(customDataPath, data));
|
|
567
|
+
}
|
|
568
|
+
catch (error) {
|
|
569
|
+
console.error(error);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return newData;
|
|
541
574
|
}
|
|
542
575
|
},
|
|
543
576
|
};
|
|
@@ -552,8 +585,8 @@ function create(mode, ts, getVueOptions, tsPluginClient) {
|
|
|
552
585
|
}
|
|
553
586
|
}
|
|
554
587
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
588
|
+
function updateExtraCustomData(extraData) {
|
|
589
|
+
extraCustomData = extraData;
|
|
557
590
|
onDidChangeCustomDataListeners.forEach(l => l());
|
|
558
591
|
}
|
|
559
592
|
function isSupportedDocument(document) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~2.1.
|
|
20
|
-
"@volar/language-service": "~2.1.
|
|
21
|
-
"@volar/typescript": "~2.1.
|
|
19
|
+
"@volar/language-core": "~2.1.2",
|
|
20
|
+
"@volar/language-service": "~2.1.2",
|
|
21
|
+
"@volar/typescript": "~2.1.2",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.6",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
25
|
"computeds": "^0.0.1",
|
|
26
26
|
"path-browserify": "^1.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"volar-service-json": "0.0.31",
|
|
31
31
|
"volar-service-pug": "0.0.31",
|
|
32
32
|
"volar-service-pug-beautify": "0.0.31",
|
|
33
|
-
"volar-service-typescript": "0.0.31",
|
|
33
|
+
"volar-service-typescript": "0.0.31-patch.1",
|
|
34
34
|
"volar-service-typescript-twoslash-queries": "0.0.31",
|
|
35
35
|
"vscode-html-languageservice": "^5.1.0",
|
|
36
36
|
"vscode-languageserver-textdocument": "^1.0.11"
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "latest",
|
|
40
40
|
"@types/path-browserify": "latest",
|
|
41
|
-
"@volar/kit": "~2.1.
|
|
42
|
-
"@vue/typescript-plugin": "2.0.
|
|
41
|
+
"@volar/kit": "~2.1.2",
|
|
42
|
+
"@vue/typescript-plugin": "2.0.6",
|
|
43
43
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
44
44
|
"vscode-uri": "^3.0.8"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "feb990ccec85f6330bba37c8b1d1287f0980274c"
|
|
47
47
|
}
|