@volar/language-service 2.3.0 → 2.3.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.d.ts +0 -1
- package/index.js +0 -1
- package/lib/features/provideAutoInsertSnippet.js +4 -5
- package/lib/features/provideCallHierarchyItems.d.ts +1 -1
- package/lib/features/provideCallHierarchyItems.js +18 -17
- package/lib/features/provideCodeActions.js +7 -8
- package/lib/features/provideCodeLenses.js +6 -8
- package/lib/features/provideColorPresentations.js +8 -10
- package/lib/features/provideCompletionItems.js +32 -21
- package/lib/features/provideDefinition.js +22 -20
- package/lib/features/provideDiagnostics.d.ts +2 -2
- package/lib/features/provideDiagnostics.js +38 -30
- package/lib/features/provideDocumentColors.js +6 -8
- package/lib/features/provideDocumentDropEdits.js +3 -4
- package/lib/features/provideDocumentFormattingEdits.js +51 -30
- package/lib/features/provideDocumentHighlights.js +12 -13
- package/lib/features/provideDocumentLinks.js +6 -8
- package/lib/features/provideDocumentSemanticTokens.js +9 -10
- package/lib/features/provideDocumentSymbols.js +6 -7
- package/lib/features/provideFileReferences.d.ts +1 -1
- package/lib/features/provideFileReferences.js +9 -8
- package/lib/features/provideFileRenameEdits.js +1 -2
- package/lib/features/provideFoldingRanges.js +5 -6
- package/lib/features/provideHover.js +5 -6
- package/lib/features/provideInlayHints.js +11 -13
- package/lib/features/provideLinkedEditingRanges.js +7 -9
- package/lib/features/provideReferences.js +15 -12
- package/lib/features/provideRenameEdits.js +10 -10
- package/lib/features/provideRenameRange.js +5 -6
- package/lib/features/provideSelectionRanges.js +18 -10
- package/lib/features/provideSignatureHelp.js +2 -3
- package/lib/features/provideWorkspaceDiagnostics.js +12 -9
- package/lib/features/provideWorkspaceSymbols.js +14 -10
- package/lib/features/resolveCodeAction.js +1 -2
- package/lib/features/resolveCodeLens.js +1 -2
- package/lib/features/resolveCompletionItem.js +9 -6
- package/lib/features/resolveDocumentLink.js +1 -2
- package/lib/features/resolveInlayHint.js +1 -2
- package/lib/languageService.d.ts +11 -5
- package/lib/languageService.js +25 -51
- package/lib/types.d.ts +0 -4
- package/lib/utils/common.d.ts +2 -3
- package/lib/utils/common.js +7 -12
- package/lib/utils/dedupe.js +10 -11
- package/lib/utils/featureWorkers.d.ts +30 -7
- package/lib/utils/featureWorkers.js +103 -55
- package/lib/utils/transform.d.ts +1 -1
- package/lib/utils/transform.js +61 -48
- package/lib/utils/uriMap.js +1 -2
- package/package.json +3 -3
- package/lib/documents.d.ts +0 -31
- package/lib/documents.js +0 -117
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const common_1 = require("../utils/common");
|
|
@@ -9,16 +9,16 @@ const transform_1 = require("../utils/transform");
|
|
|
9
9
|
const provideDiagnostics_1 = require("./provideDiagnostics");
|
|
10
10
|
function register(context) {
|
|
11
11
|
return async (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
12
|
-
let hover = await (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position,
|
|
12
|
+
let hover = await (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, docs => (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isHoverEnabled), (plugin, document, position) => {
|
|
13
13
|
if (token.isCancellationRequested) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
return plugin[1].provideHover?.(document, position, token);
|
|
17
|
-
}, (item,
|
|
18
|
-
if (!
|
|
17
|
+
}, (item, docs) => {
|
|
18
|
+
if (!docs || !item.range) {
|
|
19
19
|
return item;
|
|
20
20
|
}
|
|
21
|
-
item.range =
|
|
21
|
+
item.range = (0, featureWorkers_1.getSourceRange)(docs, item.range, language_core_1.isHoverEnabled);
|
|
22
22
|
return item;
|
|
23
23
|
}, (hovers) => ({
|
|
24
24
|
contents: {
|
|
@@ -86,5 +86,4 @@ function register(context) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
exports.register = register;
|
|
90
89
|
//# sourceMappingURL=provideHover.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const common_1 = require("../utils/common");
|
|
@@ -12,12 +12,12 @@ function register(context) {
|
|
|
12
12
|
if (!sourceScript) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => range, function* (
|
|
16
|
-
const mapped = (0, common_1.findOverlapCodeRange)(
|
|
15
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => range, function* (docs) {
|
|
16
|
+
const mapped = (0, common_1.findOverlapCodeRange)(docs[0].offsetAt(range.start), docs[0].offsetAt(range.end), docs[2], language_core_1.isInlayHintsEnabled);
|
|
17
17
|
if (mapped) {
|
|
18
18
|
yield {
|
|
19
|
-
start:
|
|
20
|
-
end:
|
|
19
|
+
start: docs[1].positionAt(mapped.start),
|
|
20
|
+
end: docs[1].positionAt(mapped.end),
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
}, async (plugin, document, arg) => {
|
|
@@ -35,17 +35,16 @@ function register(context) {
|
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
return hints;
|
|
38
|
-
}, (inlayHints,
|
|
39
|
-
if (!
|
|
38
|
+
}, (inlayHints, docs) => {
|
|
39
|
+
if (!docs) {
|
|
40
40
|
return inlayHints;
|
|
41
41
|
}
|
|
42
42
|
return inlayHints
|
|
43
43
|
.map((_inlayHint) => {
|
|
44
|
-
const position = map.getSourcePosition(_inlayHint.position, language_core_1.isInlayHintsEnabled);
|
|
45
44
|
const edits = _inlayHint.textEdits
|
|
46
|
-
?.map(textEdit => (0, transform_1.transformTextEdit)(textEdit, range =>
|
|
47
|
-
.filter(
|
|
48
|
-
|
|
45
|
+
?.map(textEdit => (0, transform_1.transformTextEdit)(textEdit, range => (0, featureWorkers_1.getSourceRange)(docs, range), docs[1]))
|
|
46
|
+
.filter(textEdit => !!textEdit);
|
|
47
|
+
for (const position of (0, featureWorkers_1.getSourcePositions)(docs, _inlayHint.position, language_core_1.isInlayHintsEnabled)) {
|
|
49
48
|
return {
|
|
50
49
|
..._inlayHint,
|
|
51
50
|
position,
|
|
@@ -53,9 +52,8 @@ function register(context) {
|
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
54
|
})
|
|
56
|
-
.filter(
|
|
55
|
+
.filter(hint => !!hint);
|
|
57
56
|
}, arr => arr.flat());
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
|
-
exports.register = register;
|
|
61
59
|
//# sourceMappingURL=provideInlayHints.js.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
-
const common_1 = require("../utils/common");
|
|
7
6
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
7
|
function register(context) {
|
|
9
8
|
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
10
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, function* (
|
|
11
|
-
for (const pos of
|
|
9
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, function* (docs) {
|
|
10
|
+
for (const pos of (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isLinkedEditingEnabled)) {
|
|
12
11
|
yield pos;
|
|
13
12
|
}
|
|
14
13
|
}, (plugin, document, position) => {
|
|
@@ -16,18 +15,17 @@ function register(context) {
|
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
return plugin[1].provideLinkedEditingRanges?.(document, position, token);
|
|
19
|
-
}, (ranges,
|
|
20
|
-
if (!
|
|
18
|
+
}, (ranges, docs) => {
|
|
19
|
+
if (!docs) {
|
|
21
20
|
return ranges;
|
|
22
21
|
}
|
|
23
22
|
return {
|
|
24
23
|
wordPattern: ranges.wordPattern,
|
|
25
24
|
ranges: ranges.ranges
|
|
26
|
-
.map(range =>
|
|
27
|
-
.filter(
|
|
25
|
+
.map(range => (0, featureWorkers_1.getSourceRange)(docs, range, language_core_1.isLinkedEditingEnabled))
|
|
26
|
+
.filter(range => !!range),
|
|
28
27
|
};
|
|
29
28
|
});
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
|
-
exports.register = register;
|
|
33
31
|
//# sourceMappingURL=provideLinkedEditingRanges.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
6
|
const cancellation_1 = require("../utils/cancellation");
|
|
@@ -8,7 +8,7 @@ const dedupe = require("../utils/dedupe");
|
|
|
8
8
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return (uri, position, referenceContext, token = cancellation_1.NoneCancellationToken) => {
|
|
11
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position,
|
|
11
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, docs => (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isReferencesEnabled), async (plugin, document, position) => {
|
|
12
12
|
if (token.isCancellationRequested) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
@@ -32,15 +32,16 @@ function register(context) {
|
|
|
32
32
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
33
33
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
34
34
|
const linkedCodeMap = virtualCode && sourceScript
|
|
35
|
-
? context.
|
|
35
|
+
? context.language.linkedCodeMaps.get(virtualCode)
|
|
36
36
|
: undefined;
|
|
37
|
-
if (linkedCodeMap) {
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (sourceScript && virtualCode && linkedCodeMap) {
|
|
38
|
+
const embeddedDocument = context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot);
|
|
39
|
+
for (const linkedPos of (0, featureWorkers_1.getLinkedCodePositions)(embeddedDocument, linkedCodeMap, reference.range.start)) {
|
|
40
|
+
if (recursiveChecker.has({ uri: embeddedDocument.uri, range: { start: linkedPos, end: linkedPos } })) {
|
|
40
41
|
continue;
|
|
41
42
|
}
|
|
42
43
|
foundMirrorPosition = true;
|
|
43
|
-
await withLinkedCode(
|
|
44
|
+
await withLinkedCode(embeddedDocument, linkedPos);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
if (!foundMirrorPosition) {
|
|
@@ -54,12 +55,15 @@ function register(context) {
|
|
|
54
55
|
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(reference.uri));
|
|
55
56
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
56
57
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
57
|
-
if (virtualCode) {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (sourceScript && virtualCode) {
|
|
59
|
+
const embeddedDocument = context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot);
|
|
60
|
+
for (const [sourceScript, map] of context.language.maps.forEach(virtualCode)) {
|
|
61
|
+
const sourceDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
|
|
62
|
+
const docs = [sourceDocument, embeddedDocument, map];
|
|
63
|
+
const range = (0, featureWorkers_1.getSourceRange)(docs, reference.range, language_core_1.isReferencesEnabled);
|
|
60
64
|
if (range) {
|
|
61
65
|
results.push({
|
|
62
|
-
uri:
|
|
66
|
+
uri: sourceDocument.uri,
|
|
63
67
|
range,
|
|
64
68
|
});
|
|
65
69
|
}
|
|
@@ -73,5 +77,4 @@ function register(context) {
|
|
|
73
77
|
}, arr => dedupe.withLocations(arr.flat()));
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
|
-
exports.register = register;
|
|
77
80
|
//# sourceMappingURL=provideReferences.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.register = register;
|
|
4
|
+
exports.mergeWorkspaceEdits = mergeWorkspaceEdits;
|
|
4
5
|
const language_core_1 = require("@volar/language-core");
|
|
5
6
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
7
|
const cancellation_1 = require("../utils/cancellation");
|
|
@@ -9,9 +10,9 @@ const featureWorkers_1 = require("../utils/featureWorkers");
|
|
|
9
10
|
const transform_1 = require("../utils/transform");
|
|
10
11
|
function register(context) {
|
|
11
12
|
return (uri, position, newName, token = cancellation_1.NoneCancellationToken) => {
|
|
12
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => ({ position, newName }), function* (
|
|
13
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => ({ position, newName }), function* (docs) {
|
|
13
14
|
let _data;
|
|
14
|
-
for (const mappedPosition of
|
|
15
|
+
for (const mappedPosition of (0, featureWorkers_1.getGeneratedPositions)(docs, position, data => {
|
|
15
16
|
_data = data;
|
|
16
17
|
return (0, language_core_1.isRenameEnabled)(data);
|
|
17
18
|
})) {
|
|
@@ -54,15 +55,16 @@ function register(context) {
|
|
|
54
55
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
55
56
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
56
57
|
const linkedCodeMap = virtualCode && sourceScript
|
|
57
|
-
? context.
|
|
58
|
+
? context.language.linkedCodeMaps.get(virtualCode)
|
|
58
59
|
: undefined;
|
|
59
|
-
if (linkedCodeMap) {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (sourceScript && virtualCode && linkedCodeMap) {
|
|
61
|
+
const embeddedDocument = context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot);
|
|
62
|
+
for (const linkedPos of (0, featureWorkers_1.getLinkedCodePositions)(embeddedDocument, linkedCodeMap, textEdit.range.start)) {
|
|
63
|
+
if (recursiveChecker.has({ uri: embeddedDocument.uri, range: { start: linkedPos, end: linkedPos } })) {
|
|
62
64
|
continue;
|
|
63
65
|
}
|
|
64
66
|
foundMirrorPosition = true;
|
|
65
|
-
await withLinkedCode(
|
|
67
|
+
await withLinkedCode(embeddedDocument, linkedPos, newName);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
if (!foundMirrorPosition) {
|
|
@@ -107,7 +109,6 @@ function register(context) {
|
|
|
107
109
|
});
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
|
-
exports.register = register;
|
|
111
112
|
function mergeWorkspaceEdits(original, ...others) {
|
|
112
113
|
for (const other of others) {
|
|
113
114
|
for (const uri in other.changeAnnotations) {
|
|
@@ -136,5 +137,4 @@ function mergeWorkspaceEdits(original, ...others) {
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
|
-
exports.mergeWorkspaceEdits = mergeWorkspaceEdits;
|
|
140
140
|
//# sourceMappingURL=provideRenameEdits.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
7
7
|
function register(context) {
|
|
8
8
|
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
9
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position,
|
|
9
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, docs => (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isRenameEnabled), (plugin, document, position) => {
|
|
10
10
|
if (token.isCancellationRequested) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
return plugin[1].provideRenameRange?.(document, position, token);
|
|
14
|
-
}, (item,
|
|
15
|
-
if (!
|
|
14
|
+
}, (item, docs) => {
|
|
15
|
+
if (!docs) {
|
|
16
16
|
return item;
|
|
17
17
|
}
|
|
18
18
|
if ('start' in item && 'end' in item) {
|
|
19
|
-
return
|
|
19
|
+
return (0, featureWorkers_1.getSourceRange)(docs, item);
|
|
20
20
|
}
|
|
21
21
|
return item;
|
|
22
22
|
}, prepares => {
|
|
@@ -29,5 +29,4 @@ function register(context) {
|
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
exports.register = register;
|
|
33
32
|
//# sourceMappingURL=provideRenameRange.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const common_1 = require("../utils/common");
|
|
@@ -8,23 +8,32 @@ const featureWorkers_1 = require("../utils/featureWorkers");
|
|
|
8
8
|
const transform_1 = require("../utils/transform");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return (uri, positions, token = cancellation_1.NoneCancellationToken) => {
|
|
11
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => positions, function* (
|
|
11
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => positions, function* (docs) {
|
|
12
12
|
const result = positions
|
|
13
|
-
.map(position =>
|
|
14
|
-
.
|
|
13
|
+
.map(position => {
|
|
14
|
+
for (const mappedPosition of (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isSelectionRangesEnabled)) {
|
|
15
|
+
return mappedPosition;
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
.filter(position => !!position);
|
|
15
19
|
if (result.length) {
|
|
16
20
|
yield result;
|
|
17
21
|
}
|
|
18
|
-
}, (plugin, document, positions) => {
|
|
22
|
+
}, async (plugin, document, positions) => {
|
|
19
23
|
if (token.isCancellationRequested) {
|
|
20
24
|
return;
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
const selectionRanges = await plugin[1].provideSelectionRanges?.(document, positions, token);
|
|
27
|
+
if (selectionRanges && selectionRanges.length !== positions.length) {
|
|
28
|
+
console.error('Selection ranges count should be equal to positions count:', plugin[0].name, selectionRanges.length, positions.length);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
return selectionRanges;
|
|
32
|
+
}, (data, docs) => {
|
|
33
|
+
if (!docs) {
|
|
25
34
|
return data;
|
|
26
35
|
}
|
|
27
|
-
return (0, transform_1.transformSelectionRanges)(data, range =>
|
|
36
|
+
return (0, transform_1.transformSelectionRanges)(data, range => (0, featureWorkers_1.getSourceRange)(docs, range, language_core_1.isSelectionRangesEnabled));
|
|
28
37
|
}, results => {
|
|
29
38
|
const result = [];
|
|
30
39
|
for (let i = 0; i < positions.length; i++) {
|
|
@@ -57,5 +66,4 @@ function register(context) {
|
|
|
57
66
|
});
|
|
58
67
|
};
|
|
59
68
|
}
|
|
60
|
-
exports.register = register;
|
|
61
69
|
//# sourceMappingURL=provideSelectionRanges.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
@@ -9,7 +9,7 @@ function register(context) {
|
|
|
9
9
|
triggerKind: 1,
|
|
10
10
|
isRetrigger: false,
|
|
11
11
|
}, token = cancellation_1.NoneCancellationToken) => {
|
|
12
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position,
|
|
12
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, docs => (0, featureWorkers_1.getGeneratedPositions)(docs, position, language_core_1.isSignatureHelpEnabled), (plugin, document, position) => {
|
|
13
13
|
if (token.isCancellationRequested) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -24,5 +24,4 @@ function register(context) {
|
|
|
24
24
|
}, data => data);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
exports.register = register;
|
|
28
27
|
//# sourceMappingURL=provideSignatureHelp.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
4
|
-
const
|
|
5
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
3
|
+
exports.register = register;
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
6
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
const provideDiagnostics_1 = require("./provideDiagnostics");
|
|
8
|
-
const language_core_1 = require("@volar/language-core");
|
|
9
8
|
function register(context) {
|
|
10
9
|
return async (token = cancellation_1.NoneCancellationToken) => {
|
|
11
10
|
const allItems = [];
|
|
@@ -36,12 +35,17 @@ function register(context) {
|
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
|
-
const map = context.
|
|
38
|
+
const map = context.language.maps.get(virtualCode, sourceScript);
|
|
39
|
+
const docs = [
|
|
40
|
+
context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot),
|
|
41
|
+
context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot),
|
|
42
|
+
map,
|
|
43
|
+
];
|
|
40
44
|
return {
|
|
41
45
|
...item,
|
|
42
46
|
items: item.items
|
|
43
|
-
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error,
|
|
44
|
-
.filter(
|
|
47
|
+
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, docs, language_core_1.shouldReportDiagnostics))
|
|
48
|
+
.filter(error => !!error)
|
|
45
49
|
};
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -53,7 +57,7 @@ function register(context) {
|
|
|
53
57
|
...item,
|
|
54
58
|
items: item.items
|
|
55
59
|
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, undefined, language_core_1.shouldReportDiagnostics))
|
|
56
|
-
.filter(
|
|
60
|
+
.filter(error => !!error)
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
});
|
|
@@ -62,5 +66,4 @@ function register(context) {
|
|
|
62
66
|
return allItems;
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
|
-
exports.register = register;
|
|
66
69
|
//# sourceMappingURL=provideWorkspaceDiagnostics.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
4
|
-
const
|
|
3
|
+
exports.register = register;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
7
|
const transform_1 = require("../utils/transform");
|
|
7
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
8
8
|
function register(context) {
|
|
9
9
|
return async (query, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
const symbolsList = [];
|
|
@@ -22,26 +22,30 @@ function register(context) {
|
|
|
22
22
|
if (!embeddedSymbols) {
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
|
-
const symbols = embeddedSymbols
|
|
25
|
+
const symbols = embeddedSymbols
|
|
26
|
+
.map(symbol => (0, transform_1.transformWorkspaceSymbol)(symbol, loc => {
|
|
26
27
|
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(loc.uri));
|
|
27
28
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
28
29
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
29
|
-
if (virtualCode) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if (sourceScript && virtualCode) {
|
|
31
|
+
const embeddedDocument = context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot);
|
|
32
|
+
for (const [sourceScript, map] of context.language.maps.forEach(virtualCode)) {
|
|
33
|
+
const sourceDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
|
|
34
|
+
const docs = [sourceDocument, embeddedDocument, map];
|
|
35
|
+
const range = (0, featureWorkers_1.getSourceRange)(docs, loc.range);
|
|
32
36
|
if (range) {
|
|
33
|
-
return { uri:
|
|
37
|
+
return { uri: sourceDocument.uri, range };
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
else {
|
|
38
42
|
return loc;
|
|
39
43
|
}
|
|
40
|
-
}))
|
|
44
|
+
}))
|
|
45
|
+
.filter(symbol => !!symbol);
|
|
41
46
|
symbolsList.push(symbols);
|
|
42
47
|
}
|
|
43
48
|
return symbolsList.flat();
|
|
44
49
|
};
|
|
45
50
|
}
|
|
46
|
-
exports.register = register;
|
|
47
51
|
//# sourceMappingURL=provideWorkspaceSymbols.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
5
|
const transform_1 = require("../utils/transform");
|
|
6
6
|
function register(context) {
|
|
@@ -24,5 +24,4 @@ function register(context) {
|
|
|
24
24
|
return item;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
exports.register = register;
|
|
28
27
|
//# sourceMappingURL=resolveCodeAction.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const vscode_uri_1 = require("vscode-uri");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const references = require("./provideReferences");
|
|
@@ -24,5 +24,4 @@ function register(context) {
|
|
|
24
24
|
return item;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
exports.register = register;
|
|
28
27
|
//# sourceMappingURL=resolveCodeLens.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
4
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
7
|
const transform_1 = require("../utils/transform");
|
|
6
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
7
8
|
function register(context) {
|
|
8
9
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
9
10
|
const data = item.data;
|
|
@@ -17,10 +18,13 @@ function register(context) {
|
|
|
17
18
|
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(data.embeddedDocumentUri));
|
|
18
19
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
19
20
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
20
|
-
if (virtualCode) {
|
|
21
|
-
|
|
21
|
+
if (sourceScript && virtualCode) {
|
|
22
|
+
const embeddedDocument = context.documents.get(context.encodeEmbeddedDocumentUri(sourceScript.id, virtualCode.id), virtualCode.languageId, virtualCode.snapshot);
|
|
23
|
+
for (const [sourceScript, map] of context.language.maps.forEach(virtualCode)) {
|
|
24
|
+
const sourceDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
|
|
25
|
+
const docs = [sourceDocument, embeddedDocument, map];
|
|
22
26
|
item = await plugin[1].resolveCompletionItem(item, token);
|
|
23
|
-
item = plugin[1].transformCompletionItem?.(item) ?? (0, transform_1.transformCompletionItem)(item, embeddedRange =>
|
|
27
|
+
item = plugin[1].transformCompletionItem?.(item) ?? (0, transform_1.transformCompletionItem)(item, embeddedRange => (0, featureWorkers_1.getSourceRange)(docs, embeddedRange), embeddedDocument, context);
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -35,5 +39,4 @@ function register(context) {
|
|
|
35
39
|
return item;
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
|
-
exports.register = register;
|
|
39
42
|
//# sourceMappingURL=resolveCompletionItem.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
5
|
const transform_1 = require("../utils/transform");
|
|
6
6
|
function register(context) {
|
|
@@ -20,5 +20,4 @@ function register(context) {
|
|
|
20
20
|
return item;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
exports.register = register;
|
|
24
23
|
//# sourceMappingURL=resolveDocumentLink.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register =
|
|
3
|
+
exports.register = register;
|
|
4
4
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
5
|
function register(context) {
|
|
6
6
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
@@ -16,5 +16,4 @@ function register(context) {
|
|
|
16
16
|
return item;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
exports.register = register;
|
|
20
19
|
//# sourceMappingURL=resolveInlayHint.js.map
|
package/lib/languageService.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Language } from '@volar/language-core';
|
|
2
2
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
import { URI } from 'vscode-uri';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LanguageServiceContext, LanguageServiceEnvironment, LanguageServicePlugin } from './types';
|
|
5
5
|
export type LanguageService = ReturnType<typeof createLanguageServiceBase>;
|
|
6
|
+
export declare const embeddedContentScheme = "volar-embedded-content";
|
|
6
7
|
export declare function createLanguageService(language: Language<URI>, plugins: LanguageServicePlugin[], env: LanguageServiceEnvironment): {
|
|
7
8
|
dispose: () => void;
|
|
8
9
|
context: LanguageServiceContext;
|
|
@@ -27,7 +28,7 @@ export declare function createLanguageService(language: Language<URI>, plugins:
|
|
|
27
28
|
getDocumentSymbols: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
28
29
|
getDocumentColors: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
29
30
|
getColorPresentations: (uri: URI, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
30
|
-
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (
|
|
31
|
+
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (result: vscode.Diagnostic[]) => void) => Promise<vscode.Diagnostic[]>;
|
|
31
32
|
getWorkspaceDiagnostics: (token?: vscode.CancellationToken) => Promise<vscode.WorkspaceDocumentDiagnosticReport[]>;
|
|
32
33
|
getReferences: (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
33
34
|
getFileReferences: (uri: URI, token?: vscode.CancellationToken) => import("./types").NullableProviderResult<vscode.Location[]>;
|
|
@@ -42,7 +43,7 @@ export declare function createLanguageService(language: Language<URI>, plugins:
|
|
|
42
43
|
} | undefined>;
|
|
43
44
|
getRenameEdits: (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
44
45
|
getFileRenameEdits: (oldUri: URI, newUri: URI, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
45
|
-
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (
|
|
46
|
+
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (tokens: vscode.SemanticTokens) => void) => Promise<vscode.SemanticTokens | undefined>;
|
|
46
47
|
getHover: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
47
48
|
getCompletionItems: (uri: URI, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
48
49
|
getCodeActions: (uri: URI, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
@@ -64,6 +65,11 @@ export declare function createLanguageService(language: Language<URI>, plugins:
|
|
|
64
65
|
resolveDocumentLink: (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
65
66
|
resolveInlayHint: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
66
67
|
};
|
|
68
|
+
export declare function decodeEmbeddedDocumentUri(maybeEmbeddedContentUri: URI): [
|
|
69
|
+
documentUri: URI,
|
|
70
|
+
embeddedCodeId: string
|
|
71
|
+
] | undefined;
|
|
72
|
+
export declare function encodeEmbeddedDocumentUri(documentUri: URI, embeddedContentId: string): URI;
|
|
67
73
|
declare function createLanguageServiceBase(plugins: LanguageServicePlugin[], context: LanguageServiceContext): {
|
|
68
74
|
dispose: () => void;
|
|
69
75
|
context: LanguageServiceContext;
|
|
@@ -88,7 +94,7 @@ declare function createLanguageServiceBase(plugins: LanguageServicePlugin[], con
|
|
|
88
94
|
getDocumentSymbols: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
89
95
|
getDocumentColors: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
90
96
|
getColorPresentations: (uri: URI, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
91
|
-
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (
|
|
97
|
+
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (result: vscode.Diagnostic[]) => void) => Promise<vscode.Diagnostic[]>;
|
|
92
98
|
getWorkspaceDiagnostics: (token?: vscode.CancellationToken) => Promise<vscode.WorkspaceDocumentDiagnosticReport[]>;
|
|
93
99
|
getReferences: (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
94
100
|
getFileReferences: (uri: URI, token?: vscode.CancellationToken) => import("./types").NullableProviderResult<vscode.Location[]>;
|
|
@@ -103,7 +109,7 @@ declare function createLanguageServiceBase(plugins: LanguageServicePlugin[], con
|
|
|
103
109
|
} | undefined>;
|
|
104
110
|
getRenameEdits: (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
105
111
|
getFileRenameEdits: (oldUri: URI, newUri: URI, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
106
|
-
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (
|
|
112
|
+
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (tokens: vscode.SemanticTokens) => void) => Promise<vscode.SemanticTokens | undefined>;
|
|
107
113
|
getHover: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
108
114
|
getCompletionItems: (uri: URI, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
109
115
|
getCodeActions: (uri: URI, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|