@vue/language-service 2.0.6 → 2.0.10
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/data/language-blocks/en.json +1 -1
- package/data/model-modifiers/ja.json +1 -1
- package/data/template/ja.json +1 -1
- package/index.d.ts +3 -2
- package/index.js +88 -23
- package/lib/ideFeatures/nameCasing.d.ts +2 -2
- package/lib/ideFeatures/nameCasing.js +23 -16
- package/lib/plugins/css.d.ts +2 -2
- package/lib/plugins/data.js +6 -3
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +5 -5
- package/lib/plugins/vue-autoinsert-dotvalue.js +37 -31
- package/lib/plugins/vue-autoinsert-parentheses.d.ts +2 -2
- package/lib/plugins/vue-autoinsert-parentheses.js +15 -6
- package/lib/plugins/vue-autoinsert-space.d.ts +2 -2
- package/lib/plugins/vue-autoinsert-space.js +7 -14
- package/lib/plugins/vue-codelens-references.d.ts +2 -2
- package/lib/plugins/vue-codelens-references.js +8 -4
- package/lib/plugins/vue-directive-comments.d.ts +2 -2
- package/lib/plugins/vue-directive-comments.js +4 -3
- package/lib/plugins/vue-document-drop.d.ts +2 -2
- package/lib/plugins/vue-document-drop.js +36 -14
- package/lib/plugins/vue-extract-file.d.ts +2 -2
- package/lib/plugins/vue-extract-file.js +32 -18
- package/lib/plugins/vue-sfc.d.ts +2 -2
- package/lib/plugins/vue-sfc.js +40 -35
- package/lib/plugins/vue-template.d.ts +3 -3
- package/lib/plugins/vue-template.js +86 -32
- package/lib/plugins/vue-toggle-v-bind-codeaction.d.ts +2 -2
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +6 -3
- package/lib/plugins/vue-twoslash-queries.d.ts +2 -2
- package/lib/plugins/vue-twoslash-queries.js +9 -5
- package/lib/plugins/vue-visualize-hidden-callback-param.d.ts +2 -2
- package/lib/plugins/vue-visualize-hidden-callback-param.js +7 -4
- package/package.json +19 -19
|
@@ -3,15 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.create = void 0;
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
5
|
const twoslashReg = /<!--\s*\^\?\s*-->/g;
|
|
6
|
-
function create(ts,
|
|
6
|
+
function create(ts, getTsPluginClient) {
|
|
7
7
|
return {
|
|
8
8
|
name: 'vue-twoslash-queries',
|
|
9
9
|
create(context) {
|
|
10
|
+
const tsPluginClient = getTsPluginClient?.(context);
|
|
10
11
|
return {
|
|
11
12
|
async provideInlayHints(document, range) {
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
14
|
+
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
15
|
+
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
16
|
+
if (!(sourceScript?.generated?.root instanceof vue.VueGeneratedCode) || virtualCode?.id !== 'template') {
|
|
14
17
|
return;
|
|
18
|
+
}
|
|
15
19
|
const hoverOffsets = [];
|
|
16
20
|
const inlayHints = [];
|
|
17
21
|
for (const pointer of document.getText(range).matchAll(twoslashReg)) {
|
|
@@ -23,9 +27,9 @@ function create(ts, tsPluginClient) {
|
|
|
23
27
|
})]);
|
|
24
28
|
}
|
|
25
29
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
26
|
-
for (const [_1, [_2, map]] of context.language.
|
|
30
|
+
for (const [_1, [_2, map]] of context.language.maps.forEach(virtualCode)) {
|
|
27
31
|
for (const [sourceOffset] of map.getSourceOffsets(hoverOffset)) {
|
|
28
|
-
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(
|
|
32
|
+
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(sourceScript.generated.root.fileName, sourceOffset);
|
|
29
33
|
if (quickInfo) {
|
|
30
34
|
inlayHints.push({
|
|
31
35
|
position: { line: pointerPosition.line, character: pointerPosition.character + 2 },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function create():
|
|
1
|
+
import type { LanguageServicePlugin } from '../types';
|
|
2
|
+
export declare function create(): LanguageServicePlugin;
|
|
@@ -9,18 +9,21 @@ function create() {
|
|
|
9
9
|
async provideInlayHints(document, range) {
|
|
10
10
|
const settings = {};
|
|
11
11
|
const result = [];
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
13
|
+
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
14
|
+
const vitualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
15
|
+
if (vitualCode) {
|
|
14
16
|
const start = document.offsetAt(range.start);
|
|
15
17
|
const end = document.offsetAt(range.end);
|
|
16
|
-
for (const mapping of
|
|
18
|
+
for (const mapping of vitualCode.mappings) {
|
|
17
19
|
const hint = mapping.data.__hint;
|
|
18
20
|
if (mapping.generatedOffsets[0] >= start
|
|
19
21
|
&& mapping.generatedOffsets[mapping.generatedOffsets.length - 1] + mapping.lengths[mapping.lengths.length - 1] <= end
|
|
20
22
|
&& hint) {
|
|
21
23
|
settings[hint.setting] ??= await context.env.getConfiguration?.(hint.setting) ?? false;
|
|
22
|
-
if (!settings[hint.setting])
|
|
24
|
+
if (!settings[hint.setting]) {
|
|
23
25
|
continue;
|
|
26
|
+
}
|
|
24
27
|
result.push({
|
|
25
28
|
label: hint.label,
|
|
26
29
|
paddingRight: hint.paddingRight,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,32 +16,32 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~2.
|
|
20
|
-
"@volar/language-service": "~2.
|
|
21
|
-
"@volar/typescript": "~2.
|
|
19
|
+
"@volar/language-core": "~2.2.0-alpha.5",
|
|
20
|
+
"@volar/language-service": "~2.2.0-alpha.5",
|
|
21
|
+
"@volar/typescript": "~2.2.0-alpha.5",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.10",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
+
"@vue/typescript-plugin": "2.0.10",
|
|
25
26
|
"computeds": "^0.0.1",
|
|
26
27
|
"path-browserify": "^1.0.1",
|
|
27
|
-
"volar-service-css": "0.0.
|
|
28
|
-
"volar-service-emmet": "0.0.
|
|
29
|
-
"volar-service-html": "0.0.
|
|
30
|
-
"volar-service-json": "0.0.
|
|
31
|
-
"volar-service-pug": "0.0.
|
|
32
|
-
"volar-service-pug-beautify": "0.0.
|
|
33
|
-
"volar-service-typescript": "0.0.
|
|
34
|
-
"volar-service-typescript-twoslash-queries": "0.0.
|
|
28
|
+
"volar-service-css": "0.0.38",
|
|
29
|
+
"volar-service-emmet": "0.0.38",
|
|
30
|
+
"volar-service-html": "0.0.38",
|
|
31
|
+
"volar-service-json": "0.0.38",
|
|
32
|
+
"volar-service-pug": "0.0.38",
|
|
33
|
+
"volar-service-pug-beautify": "0.0.38",
|
|
34
|
+
"volar-service-typescript": "0.0.38",
|
|
35
|
+
"volar-service-typescript-twoslash-queries": "0.0.38",
|
|
35
36
|
"vscode-html-languageservice": "^5.1.0",
|
|
36
|
-
"vscode-languageserver-textdocument": "^1.0.11"
|
|
37
|
+
"vscode-languageserver-textdocument": "^1.0.11",
|
|
38
|
+
"vscode-uri": "^3.0.8"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@types/node": "latest",
|
|
40
42
|
"@types/path-browserify": "latest",
|
|
41
|
-
"@volar/kit": "~2.
|
|
42
|
-
"
|
|
43
|
-
"vscode-languageserver-protocol": "^3.17.5",
|
|
44
|
-
"vscode-uri": "^3.0.8"
|
|
43
|
+
"@volar/kit": "~2.2.0-alpha.5",
|
|
44
|
+
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "a20a2ee950b63a949660b7e8faf0faed0e5bad33"
|
|
47
47
|
}
|