@vue/language-service 3.0.4 → 3.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/index.d.ts +1 -1
- package/index.js +21 -15
- package/lib/{plugins/data.js → data.js} +31 -32
- package/lib/plugins/css.js +1 -1
- package/lib/plugins/typescript-semantic-tokens.d.ts +1 -1
- package/lib/plugins/typescript-semantic-tokens.js +3 -3
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +1 -1
- package/lib/plugins/vue-autoinsert-dotvalue.js +8 -19
- package/lib/plugins/vue-autoinsert-space.js +2 -6
- package/lib/plugins/vue-compiler-dom-errors.js +1 -1
- package/lib/plugins/vue-component-semantic-tokens.d.ts +1 -1
- package/lib/plugins/vue-component-semantic-tokens.js +4 -4
- package/lib/plugins/vue-document-drop.d.ts +1 -1
- package/lib/plugins/vue-document-drop.js +4 -7
- package/lib/plugins/vue-document-highlights.d.ts +1 -1
- package/lib/plugins/vue-document-highlights.js +19 -3
- package/lib/plugins/vue-extract-file.d.ts +1 -1
- package/lib/plugins/vue-extract-file.js +3 -3
- package/lib/plugins/vue-global-types-error.js +6 -3
- package/lib/plugins/vue-inlayhints.js +1 -1
- package/lib/plugins/vue-missing-props-hints.d.ts +1 -1
- package/lib/plugins/vue-missing-props-hints.js +5 -5
- package/lib/plugins/vue-scoped-class-links.js +1 -1
- package/lib/plugins/vue-sfc.js +2 -2
- package/lib/plugins/vue-suggest-define-assignment.js +1 -1
- package/lib/plugins/vue-template-ref-links.js +1 -1
- package/lib/plugins/vue-template.d.ts +1 -1
- package/lib/plugins/vue-template.js +19 -21
- package/lib/plugins/vue-twoslash-queries.d.ts +1 -1
- package/lib/plugins/vue-twoslash-queries.js +3 -3
- package/lib/{plugins/utils.d.ts → utils.d.ts} +0 -1
- package/lib/{plugins/utils.js → utils.js} +0 -4
- package/package.json +7 -7
- package/lib/plugins/vue-autoinsert-dotvalue.d copy.d.ts +0 -2
- package/lib/plugins/vue-autoinsert-dotvalue.d copy.js +0 -3
- package/lib/plugins/vue-complete-define-assignment.d.ts +0 -2
- package/lib/plugins/vue-complete-define-assignment.js +0 -84
- package/lib/plugins/vue-destructured-props-hints.d.ts +0 -7
- package/lib/plugins/vue-destructured-props-hints.js +0 -220
- package/lib/plugins/vue-diagnostic-global-types.d.ts +0 -1
- package/lib/plugins/vue-diagnostic-global-types.js +0 -3
- package/lib/plugins/vue-document-links.d.ts +0 -2
- package/lib/plugins/vue-document-links.js +0 -109
- package/lib/types.d.ts +0 -13
- package/lib/types.js +0 -34
- /package/lib/{plugins/data.d.ts → data.d.ts} +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
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 vscode_uri_1 = require("vscode-uri");
|
|
6
|
-
function create() {
|
|
7
|
-
return {
|
|
8
|
-
name: 'vue-document-links',
|
|
9
|
-
capabilities: {
|
|
10
|
-
documentLinkProvider: {},
|
|
11
|
-
},
|
|
12
|
-
create(context) {
|
|
13
|
-
return {
|
|
14
|
-
provideDocumentLinks(document) {
|
|
15
|
-
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
16
|
-
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
17
|
-
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
18
|
-
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
19
|
-
if (!sourceScript?.generated || (virtualCode?.id !== 'template' && virtualCode?.id !== 'scriptsetup_raw')) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const root = sourceScript.generated.root;
|
|
23
|
-
if (!(root instanceof language_core_1.VueVirtualCode)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const { sfc } = root;
|
|
27
|
-
const codegen = language_core_1.tsCodegen.get(sfc);
|
|
28
|
-
const result = [];
|
|
29
|
-
if (virtualCode.id === 'template') {
|
|
30
|
-
const scopedClasses = codegen?.getGeneratedTemplate()?.scopedClasses ?? [];
|
|
31
|
-
const styleClasses = new Map();
|
|
32
|
-
const option = root.vueCompilerOptions.resolveStyleClassNames;
|
|
33
|
-
for (let i = 0; i < sfc.styles.length; i++) {
|
|
34
|
-
const style = sfc.styles[i];
|
|
35
|
-
if (option === true || (option === 'scoped' && style.scoped)) {
|
|
36
|
-
for (const className of style.classNames) {
|
|
37
|
-
if (!styleClasses.has(className.text.slice(1))) {
|
|
38
|
-
styleClasses.set(className.text.slice(1), []);
|
|
39
|
-
}
|
|
40
|
-
styleClasses.get(className.text.slice(1)).push({
|
|
41
|
-
index: i,
|
|
42
|
-
style,
|
|
43
|
-
classOffset: className.offset,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
for (const { className, offset } of scopedClasses) {
|
|
49
|
-
const styles = styleClasses.get(className);
|
|
50
|
-
if (styles) {
|
|
51
|
-
for (const style of styles) {
|
|
52
|
-
const styleDocumentUri = context.encodeEmbeddedDocumentUri(decoded[0], 'style_' + style.index);
|
|
53
|
-
const styleVirtualCode = sourceScript.generated.embeddedCodes.get('style_' + style.index);
|
|
54
|
-
if (!styleVirtualCode) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const styleDocument = context.documents.get(styleDocumentUri, styleVirtualCode.languageId, styleVirtualCode.snapshot);
|
|
58
|
-
const start = styleDocument.positionAt(style.classOffset);
|
|
59
|
-
const end = styleDocument.positionAt(style.classOffset + className.length + 1);
|
|
60
|
-
result.push({
|
|
61
|
-
range: {
|
|
62
|
-
start: document.positionAt(offset),
|
|
63
|
-
end: document.positionAt(offset + className.length),
|
|
64
|
-
},
|
|
65
|
-
target: context.encodeEmbeddedDocumentUri(decoded[0], 'style_' + style.index)
|
|
66
|
-
+ `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else if (virtualCode.id === 'scriptsetup_raw') {
|
|
73
|
-
if (!sfc.scriptSetup) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const templateVirtualCode = sourceScript.generated.embeddedCodes.get('template');
|
|
77
|
-
if (!templateVirtualCode) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const templateDocumentUri = context.encodeEmbeddedDocumentUri(decoded[0], 'template');
|
|
81
|
-
const templateDocument = context.documents.get(templateDocumentUri, templateVirtualCode.languageId, templateVirtualCode.snapshot);
|
|
82
|
-
const templateRefs = codegen?.getGeneratedTemplate()?.templateRefs;
|
|
83
|
-
const useTemplateRefs = codegen?.getScriptSetupRanges()?.useTemplateRef ?? [];
|
|
84
|
-
for (const { arg } of useTemplateRefs) {
|
|
85
|
-
if (!arg) {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
const name = sfc.scriptSetup.content.slice(arg.start + 1, arg.end - 1);
|
|
89
|
-
for (const { offset } of templateRefs?.get(name) ?? []) {
|
|
90
|
-
const start = templateDocument.positionAt(offset);
|
|
91
|
-
const end = templateDocument.positionAt(offset + name.length);
|
|
92
|
-
result.push({
|
|
93
|
-
range: {
|
|
94
|
-
start: document.positionAt(arg.start + 1),
|
|
95
|
-
end: document.positionAt(arg.end - 1),
|
|
96
|
-
},
|
|
97
|
-
target: templateDocumentUri
|
|
98
|
-
+ `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=vue-document-links.js.map
|
package/lib/types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare enum TagNameCasing {
|
|
2
|
-
Kebab = 0,
|
|
3
|
-
Pascal = 1,
|
|
4
|
-
}
|
|
5
|
-
export declare enum AttrNameCasing {
|
|
6
|
-
Kebab = 0,
|
|
7
|
-
Camel = 1,
|
|
8
|
-
}
|
|
9
|
-
export declare const commands: {
|
|
10
|
-
parseSfc: string;
|
|
11
|
-
};
|
|
12
|
-
export * from '@volar/language-service/lib/types';
|
|
13
|
-
export * from '@vue/language-core/lib/types';
|
package/lib/types.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.commands = exports.AttrNameCasing = exports.TagNameCasing = void 0;
|
|
18
|
-
var TagNameCasing;
|
|
19
|
-
(function (TagNameCasing) {
|
|
20
|
-
TagNameCasing[TagNameCasing["Kebab"] = 0] = "Kebab";
|
|
21
|
-
TagNameCasing[TagNameCasing["Pascal"] = 1] = "Pascal";
|
|
22
|
-
})(TagNameCasing || (exports.TagNameCasing = TagNameCasing = {}));
|
|
23
|
-
var AttrNameCasing;
|
|
24
|
-
(function (AttrNameCasing) {
|
|
25
|
-
AttrNameCasing[AttrNameCasing["Kebab"] = 0] = "Kebab";
|
|
26
|
-
AttrNameCasing[AttrNameCasing["Camel"] = 1] = "Camel";
|
|
27
|
-
})(AttrNameCasing || (exports.AttrNameCasing = AttrNameCasing = {}));
|
|
28
|
-
exports.commands = {
|
|
29
|
-
parseSfc: 'vue.parseSfc',
|
|
30
|
-
};
|
|
31
|
-
// only export types of depend packages
|
|
32
|
-
__exportStar(require("@volar/language-service/lib/types"), exports);
|
|
33
|
-
__exportStar(require("@vue/language-core/lib/types"), exports);
|
|
34
|
-
//# sourceMappingURL=types.js.map
|
|
File without changes
|