@vue/language-service 3.0.3 → 3.0.5
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 +1 -12
- package/index.js +25 -20
- package/lib/data.d.ts +4 -0
- package/lib/data.js +148 -0
- package/lib/plugins/css.js +9 -17
- package/lib/plugins/typescript-semantic-tokens.d.ts +2 -2
- package/lib/plugins/typescript-semantic-tokens.js +7 -15
- package/lib/plugins/vue-autoinsert-dotvalue.d copy.d.ts +2 -0
- package/lib/plugins/vue-autoinsert-dotvalue.d copy.js +3 -0
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +2 -2
- package/lib/plugins/vue-autoinsert-dotvalue.js +19 -47
- package/lib/plugins/vue-autoinsert-space.js +2 -6
- package/lib/plugins/vue-compiler-dom-errors.js +17 -35
- package/lib/plugins/vue-component-semantic-tokens.d.ts +2 -2
- package/lib/plugins/vue-component-semantic-tokens.js +35 -49
- package/lib/plugins/vue-destructured-props-hints.d.ts +7 -0
- package/lib/plugins/vue-destructured-props-hints.js +220 -0
- package/lib/plugins/vue-document-drop.d.ts +2 -2
- package/lib/plugins/vue-document-drop.js +14 -31
- package/lib/plugins/vue-document-highlights.d.ts +1 -2
- package/lib/plugins/vue-document-highlights.js +5 -12
- package/lib/plugins/vue-extract-file.d.ts +2 -2
- package/lib/plugins/vue-extract-file.js +11 -26
- package/lib/plugins/vue-global-types-error.js +17 -14
- package/lib/plugins/vue-inlayhints.js +14 -15
- package/lib/plugins/vue-missing-props-hints.d.ts +2 -2
- package/lib/plugins/vue-missing-props-hints.js +10 -26
- package/lib/plugins/vue-scoped-class-links.d.ts +2 -0
- package/lib/plugins/vue-scoped-class-links.js +62 -0
- package/lib/plugins/vue-sfc.js +141 -144
- package/lib/plugins/vue-suggest-define-assignment.js +4 -14
- package/lib/plugins/vue-template-ref-links.d.ts +2 -0
- package/lib/plugins/vue-template-ref-links.js +57 -0
- package/lib/plugins/vue-template.d.ts +2 -2
- package/lib/plugins/vue-template.js +322 -356
- package/lib/plugins/vue-twoslash-queries.d.ts +2 -2
- package/lib/plugins/vue-twoslash-queries.js +7 -16
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +43 -0
- package/package.json +7 -7
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.create = create;
|
|
4
|
+
const language_core_1 = require("@vue/language-core");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function create() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'vue-template-ref-links',
|
|
9
|
+
capabilities: {
|
|
10
|
+
documentLinkProvider: {},
|
|
11
|
+
},
|
|
12
|
+
create(context) {
|
|
13
|
+
return {
|
|
14
|
+
provideDocumentLinks(document) {
|
|
15
|
+
const info = (0, utils_1.getEmbeddedInfo)(context, document, 'scriptsetup_raw');
|
|
16
|
+
if (!info) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { sourceScript, root } = info;
|
|
20
|
+
const { sfc } = root;
|
|
21
|
+
const codegen = language_core_1.tsCodegen.get(sfc);
|
|
22
|
+
if (!sfc.scriptSetup) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const templateVirtualCode = sourceScript.generated.embeddedCodes.get('template');
|
|
26
|
+
if (!templateVirtualCode) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const templateDocumentUri = context.encodeEmbeddedDocumentUri(sourceScript.id, 'template');
|
|
30
|
+
const templateDocument = context.documents.get(templateDocumentUri, templateVirtualCode.languageId, templateVirtualCode.snapshot);
|
|
31
|
+
const templateRefs = codegen?.getGeneratedTemplate()?.templateRefs;
|
|
32
|
+
const useTemplateRefs = codegen?.getScriptSetupRanges()?.useTemplateRef ?? [];
|
|
33
|
+
return useTemplateRefs.flatMap(({ arg }) => {
|
|
34
|
+
if (!arg) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const name = sfc.scriptSetup.content.slice(arg.start + 1, arg.end - 1);
|
|
38
|
+
const range = {
|
|
39
|
+
start: document.positionAt(arg.start + 1),
|
|
40
|
+
end: document.positionAt(arg.end - 1),
|
|
41
|
+
};
|
|
42
|
+
return templateRefs?.get(name)?.map(({ offset }) => {
|
|
43
|
+
const start = templateDocument.positionAt(offset);
|
|
44
|
+
const end = templateDocument.positionAt(offset + name.length);
|
|
45
|
+
return {
|
|
46
|
+
range,
|
|
47
|
+
target: templateDocumentUri
|
|
48
|
+
+ `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`,
|
|
49
|
+
};
|
|
50
|
+
}) ?? [];
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=vue-template-ref-links.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function create(
|
|
1
|
+
import type { LanguageServicePlugin } from '@volar/language-service';
|
|
2
|
+
export declare function create(languageId: 'html' | 'jade', { getComponentNames, getElementAttrs, getComponentProps, getComponentEvents, getComponentDirectives, getComponentSlots, }: import('@vue/typescript-plugin/lib/requests').Requests): LanguageServicePlugin;
|