@vue/language-service 2.0.26-alpha.1 → 2.0.26-alpha.2
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.js
CHANGED
|
@@ -46,7 +46,6 @@ const collectExtractProps_1 = require("@vue/typescript-plugin/lib/requests/colle
|
|
|
46
46
|
const componentInfos_1 = require("@vue/typescript-plugin/lib/requests/componentInfos");
|
|
47
47
|
const getImportPathForFile_1 = require("@vue/typescript-plugin/lib/requests/getImportPathForFile");
|
|
48
48
|
const getPropertiesAtLocation_1 = require("@vue/typescript-plugin/lib/requests/getPropertiesAtLocation");
|
|
49
|
-
const getQuickInfoAtPosition_1 = require("@vue/typescript-plugin/lib/requests/getQuickInfoAtPosition");
|
|
50
49
|
const vscode_uri_1 = require("vscode-uri");
|
|
51
50
|
const nameCasing_1 = require("./lib/ideFeatures/nameCasing");
|
|
52
51
|
function getFullLanguageServicePlugins(ts) {
|
|
@@ -120,8 +119,38 @@ function getFullLanguageServicePlugins(ts) {
|
|
|
120
119
|
async getTemplateContextProps(...args) {
|
|
121
120
|
return await componentInfos_1.getTemplateContextProps.apply(requestContext, args);
|
|
122
121
|
},
|
|
123
|
-
async getQuickInfoAtPosition(
|
|
124
|
-
|
|
122
|
+
async getQuickInfoAtPosition(fileName, position) {
|
|
123
|
+
const languageService = context.getLanguageService();
|
|
124
|
+
const uri = context.project.typescript.uriConverter.asUri(fileName);
|
|
125
|
+
const sourceScript = context.language.scripts.get(uri);
|
|
126
|
+
if (!sourceScript) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const document = context.documents.get(uri, sourceScript.languageId, sourceScript.snapshot);
|
|
130
|
+
const hover = await languageService.getHover(uri, document.positionAt(position));
|
|
131
|
+
let text = '';
|
|
132
|
+
if (typeof hover?.contents === 'string') {
|
|
133
|
+
text = hover.contents;
|
|
134
|
+
}
|
|
135
|
+
else if (Array.isArray(hover?.contents)) {
|
|
136
|
+
text = hover.contents.map(c => typeof c === 'string' ? c : c.value).join('\n');
|
|
137
|
+
}
|
|
138
|
+
else if (hover) {
|
|
139
|
+
text = hover.contents.value;
|
|
140
|
+
}
|
|
141
|
+
text = text.replace(/```typescript/g, '');
|
|
142
|
+
text = text.replace(/```/g, '');
|
|
143
|
+
text = text.replace(/---/g, '');
|
|
144
|
+
text = text.trim();
|
|
145
|
+
while (true) {
|
|
146
|
+
const newText = text.replace(/\n\n/g, '\n');
|
|
147
|
+
if (newText === text) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
text = newText;
|
|
151
|
+
}
|
|
152
|
+
text = text.replace(/\n/g, ' | ');
|
|
153
|
+
return text;
|
|
125
154
|
},
|
|
126
155
|
};
|
|
127
156
|
}
|
|
@@ -147,7 +176,7 @@ function getCommonLanguageServicePlugins(ts, getTsPluginClient) {
|
|
|
147
176
|
(0, vue_template_1.create)('html', ts, getTsPluginClient),
|
|
148
177
|
(0, vue_template_1.create)('pug', ts, getTsPluginClient),
|
|
149
178
|
(0, vue_sfc_1.create)(),
|
|
150
|
-
(0, vue_twoslash_queries_1.create)(
|
|
179
|
+
(0, vue_twoslash_queries_1.create)(getTsPluginClient),
|
|
151
180
|
(0, vue_document_links_1.create)(),
|
|
152
181
|
(0, vue_document_drop_1.create)(ts, getTsPluginClient),
|
|
153
182
|
(0, vue_autoinsert_dotvalue_1.create)(ts, getTsPluginClient),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
|
|
2
|
-
export declare function create(
|
|
2
|
+
export declare function create(getTsPluginClient?: (context: LanguageServiceContext) => typeof import('@vue/typescript-plugin/lib/client') | undefined): LanguageServicePlugin;
|
|
@@ -4,7 +4,7 @@ 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;
|
|
7
|
-
function create(
|
|
7
|
+
function create(getTsPluginClient) {
|
|
8
8
|
return {
|
|
9
9
|
name: 'vue-twoslash-queries',
|
|
10
10
|
capabilities: {
|
|
@@ -31,20 +31,18 @@ function create(ts, getTsPluginClient) {
|
|
|
31
31
|
})]);
|
|
32
32
|
}
|
|
33
33
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
34
|
+
const map = context.language.maps.get(virtualCode, sourceScript);
|
|
35
|
+
for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
|
|
36
|
+
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(sourceScript.generated.root.fileName, sourceOffset);
|
|
37
|
+
if (quickInfo) {
|
|
38
|
+
inlayHints.push({
|
|
39
|
+
position: { line: pointerPosition.line, character: pointerPosition.character + 2 },
|
|
40
|
+
label: quickInfo,
|
|
41
|
+
paddingLeft: true,
|
|
42
|
+
paddingRight: false,
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
46
45
|
}
|
|
47
|
-
break;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
return inlayHints;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "2.0.26-alpha.
|
|
3
|
+
"version": "2.0.26-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "~2.4.0-alpha.
|
|
20
|
-
"@volar/language-service": "~2.4.0-alpha.
|
|
21
|
-
"@volar/typescript": "~2.4.0-alpha.
|
|
19
|
+
"@volar/language-core": "~2.4.0-alpha.12",
|
|
20
|
+
"@volar/language-service": "~2.4.0-alpha.12",
|
|
21
|
+
"@volar/typescript": "~2.4.0-alpha.12",
|
|
22
22
|
"@vue/compiler-dom": "^3.4.0",
|
|
23
|
-
"@vue/language-core": "2.0.26-alpha.
|
|
23
|
+
"@vue/language-core": "2.0.26-alpha.2",
|
|
24
24
|
"@vue/shared": "^3.4.0",
|
|
25
|
-
"@vue/typescript-plugin": "2.0.26-alpha.
|
|
25
|
+
"@vue/typescript-plugin": "2.0.26-alpha.2",
|
|
26
26
|
"computeds": "^0.0.1",
|
|
27
27
|
"path-browserify": "^1.0.1",
|
|
28
28
|
"volar-service-css": "volar-2.4",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "latest",
|
|
42
42
|
"@types/path-browserify": "latest",
|
|
43
|
-
"@volar/kit": "~2.4.0-alpha.
|
|
43
|
+
"@volar/kit": "~2.4.0-alpha.12",
|
|
44
44
|
"vscode-languageserver-protocol": "^3.17.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e4e8c8ca14dc564bf9043a625dd704b32bdc69d0"
|
|
47
47
|
}
|