@vue/language-service 2.0.20 → 2.0.22
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/zh-hk.json +1 -1
- package/data/template/zh-hk.json +2 -2
- package/index.js +4 -5
- package/lib/ideFeatures/nameCasing.d.ts +1 -1
- package/lib/ideFeatures/nameCasing.js +5 -6
- package/lib/plugins/css.js +3 -4
- package/lib/plugins/data.js +3 -4
- package/lib/plugins/vue-autoinsert-dotvalue.js +5 -6
- package/lib/plugins/vue-autoinsert-space.js +1 -2
- package/lib/plugins/vue-directive-comments.js +1 -2
- package/lib/plugins/vue-document-drop.js +1 -2
- package/lib/plugins/vue-document-links.js +1 -2
- package/lib/plugins/vue-extract-file.js +4 -5
- package/lib/plugins/vue-sfc.js +3 -4
- package/lib/plugins/vue-template.js +5 -6
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +1 -2
- package/lib/plugins/vue-twoslash-queries.js +3 -4
- package/lib/plugins/vue-visualize-hidden-callback-param.js +1 -2
- package/package.json +17 -17
- package/lib/plugins/vue-autoinsert-parentheses.d.ts +0 -2
- package/lib/plugins/vue-autoinsert-parentheses.js +0 -69
- package/lib/plugins/vue-codelens-references.d.ts +0 -2
- package/lib/plugins/vue-codelens-references.js +0 -42
|
@@ -732,7 +732,7 @@
|
|
|
732
732
|
"valueSet": "v",
|
|
733
733
|
"description": {
|
|
734
734
|
"kind": "markdown",
|
|
735
|
-
"value": "\n一个 `<style module>` 标签会被编译为 [CSS Modules](https://github.com/css-modules/css-modules) 并且将生成的 CSS class 作为 `$style` 对象暴露给组件:\n\n```vue\n<template>\n <p :class=\"$style.red\">This should be red</p>\n</template>\n\n<style module>\n.red {\n color: red;\n}\n</style>\n```\n\n得出的 class 将被哈希化以避免冲突,实现了同样的将 CSS 仅作用于当前组件的效果。\n\n参考 [CSS Modules spec](https://github.com/css-modules/css-modules) 以查看更多详情,例如 [global exceptions](https://github.com/css-modules/css-modules#exceptions) 和 [composition](https://github.com/css-modules/css-modules#composition)。\n\n### 自定义注入名称 \n\n你可以通过给 `module` attribute 一个值来自定义注入 class 对象的属性名:\n\n```vue\n<template>\n <p :class=\"classes.red\">red</p>\n</template>\n\n<style module=\"classes\">\n.red {\n color: red;\n}\n</style>\n```\n\n### 与组合式 API 一同使用 \n\n可以通过 `useCssModule` API 在 `setup()` 和 `<script setup>` 中访问注入的 class。对于使用了自定义注入名称的 `<style module>` 块,`useCssModule` 接收一个匹配的 `module` attribute 值作为第一个参数:\n\n```js\nimport { useCssModule } from 'vue'\n\n// 在 setup() 作用域中...\n// 默认情况下, 返回 <style module> 的 class\nuseCssModule()\n\n// 具名情况下, 返回 <style module=\"classes\"> 的 class\nuseCssModule('classes')\n```\n"
|
|
735
|
+
"value": "\n一个 `<style module>` 标签会被编译为 [CSS Modules](https://github.com/css-modules/css-modules) 并且将生成的 CSS class 作为 `$style` 对象暴露给组件:\n\n```vue\n<template>\n <p :class=\"$style.red\">This should be red</p>\n</template>\n\n<style module>\n.red {\n color: red;\n}\n</style>\n```\n\n得出的 class 将被哈希化以避免冲突,实现了同样的将 CSS 仅作用于当前组件的效果。\n\n参考 [CSS Modules spec](https://github.com/css-modules/css-modules) 以查看更多详情,例如 [global exceptions](https://github.com/css-modules/css-modules/blob/master/docs/composition.md#exceptions) 和 [composition](https://github.com/css-modules/css-modules/blob/master/docs/composition.md#composition)。\n\n### 自定义注入名称 \n\n你可以通过给 `module` attribute 一个值来自定义注入 class 对象的属性名:\n\n```vue\n<template>\n <p :class=\"classes.red\">red</p>\n</template>\n\n<style module=\"classes\">\n.red {\n color: red;\n}\n</style>\n```\n\n### 与组合式 API 一同使用 \n\n可以通过 `useCssModule` API 在 `setup()` 和 `<script setup>` 中访问注入的 class。对于使用了自定义注入名称的 `<style module>` 块,`useCssModule` 接收一个匹配的 `module` attribute 值作为第一个参数:\n\n```js\nimport { useCssModule } from 'vue'\n\n// 在 setup() 作用域中...\n// 默认情况下, 返回 <style module> 的 class\nuseCssModule()\n\n// 具名情况下, 返回 <style module=\"classes\"> 的 class\nuseCssModule('classes')\n```\n"
|
|
736
736
|
},
|
|
737
737
|
"references": [
|
|
738
738
|
{
|
package/data/template/zh-hk.json
CHANGED
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
"name": "Suspense",
|
|
254
254
|
"description": {
|
|
255
255
|
"kind": "markdown",
|
|
256
|
-
"value": "\n用于协调对组件树中嵌套的异步依赖的处理。\n\n- **Props**\n\n ```ts\n interface SuspenseProps {\n timeout?: string | number\n }\n ```\n\n- **事件**\n\n - `@resolve`\n - `@pending`\n - `@fallback`\n\n- **详细信息**\n\n `<Suspense>` 接受两个插槽:`#default` 和 `#fallback`。它将在内存中渲染默认插槽的同时展示后备插槽内容。\n\n 如果在渲染时遇到异步依赖项 ([异步组件](https://zh-hk.vuejs.org/guide/components/async.html)和具有 [`async setup()`](https://zh-hk.vuejs.org/guide/built-ins/suspense.html#async-setup) 的组件),它将等到所有异步依赖项解析完成时再显示默认插槽。\n\n- **参考**[指南 - Suspense](https://zh-hk.vuejs.org/guide/built-ins/suspense.html)\n"
|
|
256
|
+
"value": "\n用于协调对组件树中嵌套的异步依赖的处理。\n\n- **Props**\n\n ```ts\n interface SuspenseProps {\n timeout?: string | number\n suspensible?: boolean\n }\n ```\n\n- **事件**\n\n - `@resolve`\n - `@pending`\n - `@fallback`\n\n- **详细信息**\n\n `<Suspense>` 接受两个插槽:`#default` 和 `#fallback`。它将在内存中渲染默认插槽的同时展示后备插槽内容。\n\n 如果在渲染时遇到异步依赖项 ([异步组件](https://zh-hk.vuejs.org/guide/components/async.html)和具有 [`async setup()`](https://zh-hk.vuejs.org/guide/built-ins/suspense.html#async-setup) 的组件),它将等到所有异步依赖项解析完成时再显示默认插槽。\n\n 通過將 Suspense 設置為 `suspensible`,所有異步依賴處理將由父 Suspense 處理。參見[實現細節](https://github.com/vuejs/core/pull/673)\n\n- **参考**[指南 - Suspense](https://zh-hk.vuejs.org/guide/built-ins/suspense.html)\n"
|
|
257
257
|
},
|
|
258
258
|
"attributes": [],
|
|
259
259
|
"references": [
|
|
@@ -1236,7 +1236,7 @@
|
|
|
1236
1236
|
"name": "v-once",
|
|
1237
1237
|
"description": {
|
|
1238
1238
|
"kind": "markdown",
|
|
1239
|
-
"value": "\n仅渲染元素和组件一次,并跳过之后的更新。\n\n- **无需传入**\n\n- **详细信息**\n\n 在随后的重新渲染,元素/组件及其所有子项将被当作静态内容并跳过渲染。这可以用来优化更新时的性能。\n\n ```html\n <!-- 单个元素 -->\n <span v-once>This will never change: {{msg}}</span>\n <!-- 带有子元素的元素 -->\n <div v-once>\n <h1>
|
|
1239
|
+
"value": "\n仅渲染元素和组件一次,并跳过之后的更新。\n\n- **无需传入**\n\n- **详细信息**\n\n 在随后的重新渲染,元素/组件及其所有子项将被当作静态内容并跳过渲染。这可以用来优化更新时的性能。\n\n ```html\n <!-- 单个元素 -->\n <span v-once>This will never change: {{msg}}</span>\n <!-- 带有子元素的元素 -->\n <div v-once>\n <h1>Comment</h1>\n <p>{{msg}}</p>\n </div>\n <!-- 组件 -->\n <MyComponent v-once :comment=\"msg\" />\n <!-- `v-for` 指令 -->\n <ul>\n <li v-for=\"i in list\" v-once>{{i}}</li>\n </ul>\n ```\n\n 从 3.2 起,你也可以搭配 [`v-memo`](#v-memo) 的无效条件来缓存部分模板。\n\n- **参考**\n - [数据绑定语法 - 插值](https://zh-hk.vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n - [v-memo](#v-memo)\n"
|
|
1240
1240
|
},
|
|
1241
1241
|
"references": [
|
|
1242
1242
|
{
|
package/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.getVueLanguageServicePlugins = getVueLanguageServicePlugins;
|
|
18
|
+
exports.createDefaultGetTsPluginClient = createDefaultGetTsPluginClient;
|
|
18
19
|
__exportStar(require("@volar/language-service"), exports);
|
|
19
20
|
__exportStar(require("@vue/language-core"), exports);
|
|
20
21
|
__exportStar(require("./lib/ideFeatures/nameCasing"), exports);
|
|
@@ -54,8 +55,8 @@ function getVueLanguageServicePlugins(ts, getVueOptions, getTsPluginClient = cre
|
|
|
54
55
|
if (plugin.name === 'typescript-semantic') {
|
|
55
56
|
plugins[i] = {
|
|
56
57
|
...plugin,
|
|
57
|
-
create(context
|
|
58
|
-
const created = plugin.create(context
|
|
58
|
+
create(context) {
|
|
59
|
+
const created = plugin.create(context);
|
|
59
60
|
if (!context.language.typescript) {
|
|
60
61
|
return created;
|
|
61
62
|
}
|
|
@@ -80,7 +81,6 @@ function getVueLanguageServicePlugins(ts, getVueOptions, getTsPluginClient = cre
|
|
|
80
81
|
}));
|
|
81
82
|
return plugins;
|
|
82
83
|
}
|
|
83
|
-
exports.getVueLanguageServicePlugins = getVueLanguageServicePlugins;
|
|
84
84
|
function createDefaultGetTsPluginClient(ts) {
|
|
85
85
|
return context => {
|
|
86
86
|
if (!context.language.typescript) {
|
|
@@ -129,5 +129,4 @@ function createDefaultGetTsPluginClient(ts) {
|
|
|
129
129
|
};
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
exports.createDefaultGetTsPluginClient = createDefaultGetTsPluginClient;
|
|
133
132
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LanguageServiceContext } from '@volar/language-service';
|
|
2
2
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
import { AttrNameCasing, TagNameCasing } from '../types';
|
|
4
3
|
import type { URI } from 'vscode-uri';
|
|
4
|
+
import { AttrNameCasing, TagNameCasing } from '../types';
|
|
5
5
|
export declare function convertTagName(context: LanguageServiceContext, uri: URI, casing: TagNameCasing, tsPluginClient: typeof import('@vue/typescript-plugin/lib/client') | undefined): Promise<vscode.TextEdit[] | undefined>;
|
|
6
6
|
export declare function convertAttrName(context: LanguageServiceContext, uri: URI, casing: AttrNameCasing, tsPluginClient?: typeof import('@vue/typescript-plugin/lib/client')): Promise<vscode.TextEdit[] | undefined>;
|
|
7
7
|
export declare function getNameCasing(context: LanguageServiceContext, uri: URI): Promise<{
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.convertTagName = convertTagName;
|
|
4
|
+
exports.convertAttrName = convertAttrName;
|
|
5
|
+
exports.getNameCasing = getNameCasing;
|
|
6
|
+
exports.detect = detect;
|
|
4
7
|
const vue = require("@vue/language-core");
|
|
5
8
|
const language_core_1 = require("@vue/language-core");
|
|
6
9
|
const computeds_1 = require("computeds");
|
|
@@ -41,7 +44,6 @@ async function convertTagName(context, uri, casing, tsPluginClient) {
|
|
|
41
44
|
}
|
|
42
45
|
return edits;
|
|
43
46
|
}
|
|
44
|
-
exports.convertTagName = convertTagName;
|
|
45
47
|
async function convertAttrName(context, uri, casing, tsPluginClient) {
|
|
46
48
|
const sourceFile = context.language.scripts.get(uri);
|
|
47
49
|
if (!sourceFile) {
|
|
@@ -84,7 +86,6 @@ async function convertAttrName(context, uri, casing, tsPluginClient) {
|
|
|
84
86
|
}
|
|
85
87
|
return edits;
|
|
86
88
|
}
|
|
87
|
-
exports.convertAttrName = convertAttrName;
|
|
88
89
|
async function getNameCasing(context, uri) {
|
|
89
90
|
const detected = await detect(context, uri);
|
|
90
91
|
const [attr, tag] = await Promise.all([
|
|
@@ -98,7 +99,6 @@ async function getNameCasing(context, uri) {
|
|
|
98
99
|
attr: attrNameCasing,
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
|
-
exports.getNameCasing = getNameCasing;
|
|
102
102
|
async function detect(context, uri) {
|
|
103
103
|
const rootFile = context.language.scripts.get(uri)?.generated?.root;
|
|
104
104
|
if (!(rootFile instanceof language_core_1.VueVirtualCode)) {
|
|
@@ -132,7 +132,7 @@ async function detect(context, uri) {
|
|
|
132
132
|
}
|
|
133
133
|
return result;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
function getTagNameCase(file) {
|
|
136
136
|
const result = new Set();
|
|
137
137
|
if (file.sfc.template?.ast) {
|
|
138
138
|
for (const element of vue.forEachElementNode(file.sfc.template.ast)) {
|
|
@@ -152,7 +152,6 @@ async function detect(context, uri) {
|
|
|
152
152
|
return [...result];
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
exports.detect = detect;
|
|
156
155
|
const map = new WeakMap();
|
|
157
156
|
function getTemplateTagsAndAttrs(sourceFile) {
|
|
158
157
|
if (!map.has(sourceFile)) {
|
package/lib/plugins/css.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const volar_service_css_1 = require("volar-service-css");
|
|
5
5
|
function create() {
|
|
6
6
|
const base = (0, volar_service_css_1.create)({ scssDocumentSelector: ['scss', 'postcss'] });
|
|
7
7
|
return {
|
|
8
8
|
...base,
|
|
9
|
-
create(context
|
|
10
|
-
const baseInstance = base.create(context
|
|
9
|
+
create(context) {
|
|
10
|
+
const baseInstance = base.create(context);
|
|
11
11
|
return {
|
|
12
12
|
...baseInstance,
|
|
13
13
|
async provideDiagnostics(document, token) {
|
|
@@ -23,5 +23,4 @@ function create() {
|
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
exports.create = create;
|
|
27
26
|
//# sourceMappingURL=css.js.map
|
package/lib/plugins/data.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.loadTemplateData = loadTemplateData;
|
|
4
|
+
exports.loadLanguageBlocks = loadLanguageBlocks;
|
|
5
|
+
exports.loadModelModifiersData = loadModelModifiersData;
|
|
4
6
|
function loadTemplateData(lang) {
|
|
5
7
|
lang = lang.toLowerCase();
|
|
6
8
|
let data;
|
|
@@ -53,7 +55,6 @@ function loadTemplateData(lang) {
|
|
|
53
55
|
}
|
|
54
56
|
return data;
|
|
55
57
|
}
|
|
56
|
-
exports.loadTemplateData = loadTemplateData;
|
|
57
58
|
function loadLanguageBlocks(lang) {
|
|
58
59
|
lang = lang.toLowerCase();
|
|
59
60
|
if (lang === 'ja') {
|
|
@@ -85,7 +86,6 @@ function loadLanguageBlocks(lang) {
|
|
|
85
86
|
}
|
|
86
87
|
return require('../../data/language-blocks/en.json');
|
|
87
88
|
}
|
|
88
|
-
exports.loadLanguageBlocks = loadLanguageBlocks;
|
|
89
89
|
function loadModelModifiersData(lang) {
|
|
90
90
|
lang = lang.toLowerCase();
|
|
91
91
|
if (lang === 'ja') {
|
|
@@ -117,5 +117,4 @@ function loadModelModifiersData(lang) {
|
|
|
117
117
|
}
|
|
118
118
|
return require('../../data/model-modifiers/en.json');
|
|
119
119
|
}
|
|
120
|
-
exports.loadModelModifiersData = loadModelModifiersData;
|
|
121
120
|
//# sourceMappingURL=data.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.create = create;
|
|
4
|
+
exports.isCharacterTyping = isCharacterTyping;
|
|
5
|
+
exports.isBlacklistNode = isBlacklistNode;
|
|
4
6
|
const language_core_1 = require("@vue/language-core");
|
|
5
7
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
8
|
const asts = new WeakMap();
|
|
@@ -63,8 +65,8 @@ function create(ts, getTsPluginClient) {
|
|
|
63
65
|
}
|
|
64
66
|
ast = getAst(ts, fileName, virtualCode.snapshot, serviceScript.scriptKind);
|
|
65
67
|
let mapped = false;
|
|
66
|
-
for (const [
|
|
67
|
-
for (const [sourceOffset] of map.
|
|
68
|
+
for (const [_sourceScript, map] of context.language.maps.forEach(virtualCode)) {
|
|
69
|
+
for (const [sourceOffset] of map.toSourceLocation(document.offsetAt(selection))) {
|
|
68
70
|
sourceCodeOffset = sourceOffset;
|
|
69
71
|
mapped = true;
|
|
70
72
|
break;
|
|
@@ -92,7 +94,6 @@ function create(ts, getTsPluginClient) {
|
|
|
92
94
|
},
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
|
-
exports.create = create;
|
|
96
97
|
function sleep(ms) {
|
|
97
98
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
98
99
|
}
|
|
@@ -114,7 +115,6 @@ function isCharacterTyping(document, change) {
|
|
|
114
115
|
}
|
|
115
116
|
return charReg.test(lastCharacter) && !charReg.test(nextCharacter);
|
|
116
117
|
}
|
|
117
|
-
exports.isCharacterTyping = isCharacterTyping;
|
|
118
118
|
function isBlacklistNode(ts, node, pos, allowAccessDotValue) {
|
|
119
119
|
if (ts.isVariableDeclaration(node) && pos >= node.name.getFullStart() && pos <= node.name.getEnd()) {
|
|
120
120
|
return true;
|
|
@@ -188,5 +188,4 @@ function isBlacklistNode(ts, node, pos, allowAccessDotValue) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
exports.isBlacklistNode = isBlacklistNode;
|
|
192
191
|
//# sourceMappingURL=vue-autoinsert-dotvalue.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
function create() {
|
|
5
5
|
return {
|
|
6
6
|
name: 'vue-autoinsert-space',
|
|
@@ -29,5 +29,4 @@ function create() {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
exports.create = create;
|
|
33
32
|
//# sourceMappingURL=vue-autoinsert-space.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const cmds = [
|
|
5
5
|
'vue-ignore',
|
|
6
6
|
'vue-skip',
|
|
@@ -62,5 +62,4 @@ function create() {
|
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
exports.create = create;
|
|
66
65
|
//# sourceMappingURL=vue-directive-comments.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const shared_1 = require("@vue/shared");
|
|
6
6
|
const path = require("path-browserify");
|
|
@@ -106,5 +106,4 @@ function create(ts, getVueOptions, getTsPluginClient) {
|
|
|
106
106
|
},
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
exports.create = create;
|
|
110
109
|
//# sourceMappingURL=vue-document-drop.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
6
|
function create() {
|
|
@@ -65,5 +65,4 @@ function create() {
|
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
exports.create = create;
|
|
69
68
|
//# sourceMappingURL=vue-document-links.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.create = create;
|
|
4
|
+
exports.getLastImportNode = getLastImportNode;
|
|
5
|
+
exports.createAddComponentToOptionEdit = createAddComponentToOptionEdit;
|
|
4
6
|
const language_core_1 = require("@vue/language-core");
|
|
5
7
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
8
|
const unicodeReg = /\\u/g;
|
|
@@ -15,7 +17,7 @@ function create(ts, getTsPluginClient) {
|
|
|
15
17
|
create(context) {
|
|
16
18
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
17
19
|
return {
|
|
18
|
-
|
|
20
|
+
provideCodeActions(document, range, _context) {
|
|
19
21
|
const startOffset = document.offsetAt(range.start);
|
|
20
22
|
const endOffset = document.offsetAt(range.end);
|
|
21
23
|
if (startOffset === endOffset) {
|
|
@@ -188,7 +190,6 @@ function create(ts, getTsPluginClient) {
|
|
|
188
190
|
},
|
|
189
191
|
};
|
|
190
192
|
}
|
|
191
|
-
exports.create = create;
|
|
192
193
|
function selectTemplateCode(startOffset, endOffset, templateBlock) {
|
|
193
194
|
const insideNodes = [];
|
|
194
195
|
templateBlock.ast?.children.forEach(function visit(node) {
|
|
@@ -237,7 +238,6 @@ function getLastImportNode(ts, sourceFile) {
|
|
|
237
238
|
}
|
|
238
239
|
return lastImportNode;
|
|
239
240
|
}
|
|
240
|
-
exports.getLastImportNode = getLastImportNode;
|
|
241
241
|
function createAddComponentToOptionEdit(ts, ast, componentName) {
|
|
242
242
|
const exportDefault = language_core_1.scriptRanges.parseScriptRanges(ts, ast, false, true).exportDefault;
|
|
243
243
|
if (!exportDefault) {
|
|
@@ -274,5 +274,4 @@ function createAddComponentToOptionEdit(ts, ast, componentName) {
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
exports.createAddComponentToOptionEdit = createAddComponentToOptionEdit;
|
|
278
277
|
//# sourceMappingURL=vue-extract-file.js.map
|
package/lib/plugins/vue-sfc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
5
|
const volar_service_html_1 = require("volar-service-html");
|
|
6
6
|
const html = require("vscode-html-languageservice");
|
|
@@ -38,8 +38,8 @@ function create() {
|
|
|
38
38
|
return {
|
|
39
39
|
...htmlPlugin,
|
|
40
40
|
name: 'vue-sfc',
|
|
41
|
-
create(context
|
|
42
|
-
const htmlPluginInstance = htmlPlugin.create(context
|
|
41
|
+
create(context) {
|
|
42
|
+
const htmlPluginInstance = htmlPlugin.create(context);
|
|
43
43
|
return {
|
|
44
44
|
...htmlPluginInstance,
|
|
45
45
|
provide: {
|
|
@@ -166,5 +166,4 @@ function create() {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
exports.create = create;
|
|
170
169
|
//# sourceMappingURL=vue-sfc.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const shared_1 = require("@vue/shared");
|
|
6
6
|
const volar_service_html_1 = require("volar-service-html");
|
|
@@ -58,7 +58,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
58
58
|
},
|
|
59
59
|
inlayHintProvider: {},
|
|
60
60
|
hoverProvider: true,
|
|
61
|
-
diagnosticProvider:
|
|
61
|
+
diagnosticProvider: {},
|
|
62
62
|
semanticTokensProvider: {
|
|
63
63
|
legend: {
|
|
64
64
|
tokenTypes: ['class'],
|
|
@@ -66,9 +66,9 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
66
66
|
},
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
create(context
|
|
69
|
+
create(context) {
|
|
70
70
|
const tsPluginClient = getTsPluginClient?.(context);
|
|
71
|
-
const baseServiceInstance = baseService.create(context
|
|
71
|
+
const baseServiceInstance = baseService.create(context);
|
|
72
72
|
const vueCompilerOptions = getVueOptions(context.env);
|
|
73
73
|
builtInData ??= (0, data_1.loadTemplateData)(context.env.locale ?? 'en');
|
|
74
74
|
modelData ??= (0, data_1.loadModelModifiersData)(context.env.locale ?? 'en');
|
|
@@ -529,7 +529,7 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
|
-
|
|
532
|
+
function afterHtmlCompletion(completionList, sourceDocument) {
|
|
533
533
|
const replacement = getReplacement(completionList, sourceDocument);
|
|
534
534
|
if (replacement) {
|
|
535
535
|
const isEvent = replacement.text.startsWith('v-on:') || replacement.text.startsWith('@');
|
|
@@ -686,7 +686,6 @@ function create(mode, ts, getVueOptions, getTsPluginClient) {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
exports.create = create;
|
|
690
689
|
;
|
|
691
690
|
function createInternalItemId(type, args) {
|
|
692
691
|
return '__VLS_::' + type + '::' + args.join(',');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const language_core_1 = require("@vue/language-core");
|
|
5
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
6
|
function create(ts) {
|
|
@@ -131,5 +131,4 @@ function create(ts) {
|
|
|
131
131
|
},
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
exports.create = create;
|
|
135
134
|
//# sourceMappingURL=vue-toggle-v-bind-codeaction.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
6
|
const twoslashReg = /<!--\s*\^\?\s*-->/g;
|
|
@@ -31,8 +31,8 @@ function create(ts, getTsPluginClient) {
|
|
|
31
31
|
})]);
|
|
32
32
|
}
|
|
33
33
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
34
|
-
for (const [
|
|
35
|
-
for (const [sourceOffset] of map.
|
|
34
|
+
for (const [_sourceScript, map] of context.language.maps.forEach(virtualCode)) {
|
|
35
|
+
for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
|
|
36
36
|
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(sourceScript.generated.root.fileName, sourceOffset);
|
|
37
37
|
if (quickInfo) {
|
|
38
38
|
inlayHints.push({
|
|
@@ -53,5 +53,4 @@ function create(ts, getTsPluginClient) {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
exports.create = create;
|
|
57
56
|
//# sourceMappingURL=vue-twoslash-queries.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const vscode_uri_1 = require("vscode-uri");
|
|
5
5
|
function create() {
|
|
6
6
|
return {
|
|
@@ -48,5 +48,4 @@ function create() {
|
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
exports.create = create;
|
|
52
51
|
//# sourceMappingURL=vue-visualize-hidden-callback-param.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
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.3.
|
|
20
|
-
"@volar/language-service": "~2.3.
|
|
21
|
-
"@volar/typescript": "~2.3.
|
|
19
|
+
"@volar/language-core": "~2.3.1",
|
|
20
|
+
"@volar/language-service": "~2.3.1",
|
|
21
|
+
"@volar/typescript": "~2.3.1",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.
|
|
23
|
+
"@vue/language-core": "2.0.22",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
-
"@vue/typescript-plugin": "2.0.
|
|
25
|
+
"@vue/typescript-plugin": "2.0.22",
|
|
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.
|
|
36
|
-
"vscode-html-languageservice": "
|
|
28
|
+
"volar-service-css": "0.0.52",
|
|
29
|
+
"volar-service-emmet": "0.0.52",
|
|
30
|
+
"volar-service-html": "0.0.52",
|
|
31
|
+
"volar-service-json": "0.0.52",
|
|
32
|
+
"volar-service-pug": "0.0.52",
|
|
33
|
+
"volar-service-pug-beautify": "0.0.52",
|
|
34
|
+
"volar-service-typescript": "0.0.52",
|
|
35
|
+
"volar-service-typescript-twoslash-queries": "0.0.52",
|
|
36
|
+
"vscode-html-languageservice": "^5.2.0",
|
|
37
37
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
38
38
|
"vscode-uri": "^3.0.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "latest",
|
|
42
42
|
"@types/path-browserify": "latest",
|
|
43
|
-
"@volar/kit": "~2.3.
|
|
43
|
+
"@volar/kit": "~2.3.1",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "884c8a553d4fd240167fcb97c6a738564f9d697a"
|
|
47
47
|
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const vue_autoinsert_dotvalue_1 = require("./vue-autoinsert-dotvalue");
|
|
5
|
-
function create(ts) {
|
|
6
|
-
return {
|
|
7
|
-
name: 'vue-autoinsert-parentheses',
|
|
8
|
-
create(context) {
|
|
9
|
-
return {
|
|
10
|
-
async provideAutoInsertionEdit(document, selection, change) {
|
|
11
|
-
// selection must at end of change
|
|
12
|
-
if (document.offsetAt(selection) !== change.rangeOffset + change.text.length) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const enabled = await context.env.getConfiguration?.('vue.autoInsert.parentheses') ?? false;
|
|
16
|
-
if (!enabled) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!(0, vue_autoinsert_dotvalue_1.isCharacterTyping)(document, change)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const decoded = context.decodeEmbeddedDocumentUri(document.uri);
|
|
23
|
-
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
24
|
-
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
25
|
-
if (!virtualCode?.id.startsWith('template_inline_ts_')) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const offset = document.offsetAt(selection);
|
|
29
|
-
for (const mappedRange of virtualCode.mappings) {
|
|
30
|
-
const generatedCodeEnd = mappedRange.generatedOffsets[mappedRange.generatedOffsets.length - 1]
|
|
31
|
-
+ mappedRange.lengths[mappedRange.lengths.length - 1];
|
|
32
|
-
if (generatedCodeEnd === offset) {
|
|
33
|
-
const text = document.getText().substring(mappedRange.generatedOffsets[0], generatedCodeEnd);
|
|
34
|
-
const ast = ts.createSourceFile('', text, ts.ScriptTarget.Latest);
|
|
35
|
-
if (ast.statements.length === 1) {
|
|
36
|
-
const statement = ast.statements[0];
|
|
37
|
-
if (ts.isExpressionStatement(statement)
|
|
38
|
-
&& ((ts.isAsExpression(statement.expression)
|
|
39
|
-
&& ts.isTypeReferenceNode(statement.expression.type)
|
|
40
|
-
&& ts.isIdentifier(statement.expression.type.typeName)
|
|
41
|
-
&& statement.expression.type.typeName.text)
|
|
42
|
-
|| (ts.isBinaryExpression(statement.expression)
|
|
43
|
-
&& statement.expression.right.getText(ast)
|
|
44
|
-
&& statement.expression.operatorToken.kind === ts.SyntaxKind.InstanceOfKeyword)
|
|
45
|
-
|| (ts.isTypeOfExpression(statement.expression)
|
|
46
|
-
&& statement.expression.expression.getText(ast)))) {
|
|
47
|
-
// https://code.visualstudio.com/docs/editor/userdefinedsnippets#_grammar
|
|
48
|
-
const escapedText = text
|
|
49
|
-
.replaceAll('\\', '\\\\')
|
|
50
|
-
.replaceAll('$', '\\$')
|
|
51
|
-
.replaceAll('}', '\\}');
|
|
52
|
-
return {
|
|
53
|
-
range: {
|
|
54
|
-
start: document.positionAt(mappedRange.generatedOffsets[0]),
|
|
55
|
-
end: document.positionAt(generatedCodeEnd),
|
|
56
|
-
},
|
|
57
|
-
newText: '(' + escapedText + '$0' + ')',
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
exports.create = create;
|
|
69
|
-
//# sourceMappingURL=vue-autoinsert-parentheses.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = void 0;
|
|
4
|
-
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
function create() {
|
|
6
|
-
return {
|
|
7
|
-
name: 'vue-codelens-references',
|
|
8
|
-
create(context) {
|
|
9
|
-
return {
|
|
10
|
-
provideReferencesCodeLensRanges(document) {
|
|
11
|
-
return worker(document.uri, virtualCode => {
|
|
12
|
-
const result = [];
|
|
13
|
-
for (const map of context.documents.getMaps(virtualCode) ?? []) {
|
|
14
|
-
for (const mapping of map.map.mappings) {
|
|
15
|
-
if (!mapping.data.__referencesCodeLens) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
result.push({
|
|
19
|
-
start: document.positionAt(mapping.generatedOffsets[0]),
|
|
20
|
-
end: document.positionAt(mapping.generatedOffsets[mapping.generatedOffsets.length - 1]
|
|
21
|
-
+ mapping.lengths[mapping.lengths.length - 1]),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
function worker(uri, callback) {
|
|
30
|
-
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
31
|
-
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
32
|
-
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
33
|
-
if (!virtualCode || !(sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) || !sourceScript) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
return callback(virtualCode, sourceScript);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
exports.create = create;
|
|
42
|
-
//# sourceMappingURL=vue-codelens-references.js.map
|