@volar/language-service 1.0.0-beta.1 → 1.0.0-beta.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/out/baseDocumentService.js +1 -1
- package/out/baseLanguageService.d.ts +1 -1
- package/out/baseLanguageService.js +2 -2
- package/out/documentFeatures/autoInsert.js +2 -9
- package/out/documentFeatures/colorPresentations.js +7 -14
- package/out/documentFeatures/documentColors.js +1 -4
- package/out/documentFeatures/documentSymbols.js +3 -6
- package/out/documentFeatures/foldingRanges.js +1 -6
- package/out/documentFeatures/format.js +23 -30
- package/out/documentFeatures/linkedEditingRanges.js +2 -11
- package/out/documentFeatures/selectionRanges.js +3 -8
- package/out/documents.d.ts +23 -49
- package/out/documents.js +105 -73
- package/out/languageFeatures/autoInsert.js +20 -21
- package/out/languageFeatures/callHierarchy.js +17 -13
- package/out/languageFeatures/codeActions.js +10 -9
- package/out/languageFeatures/codeLens.js +1 -2
- package/out/languageFeatures/complete.js +11 -7
- package/out/languageFeatures/completeResolve.d.ts +1 -1
- package/out/languageFeatures/completeResolve.js +8 -8
- package/out/languageFeatures/definition.js +17 -20
- package/out/languageFeatures/documentHighlights.js +7 -10
- package/out/languageFeatures/documentLinks.js +4 -5
- package/out/languageFeatures/documentSemanticTokens.js +21 -23
- package/out/languageFeatures/executeCommand.d.ts +1 -1
- package/out/languageFeatures/executeCommand.js +1 -1
- package/out/languageFeatures/fileReferences.js +13 -11
- package/out/languageFeatures/fileRename.js +1 -1
- package/out/languageFeatures/hover.js +6 -13
- package/out/languageFeatures/inlayHints.js +12 -11
- package/out/languageFeatures/references.js +14 -13
- package/out/languageFeatures/rename.d.ts +0 -13
- package/out/languageFeatures/rename.js +49 -37
- package/out/languageFeatures/renamePrepare.js +6 -8
- package/out/languageFeatures/signatureHelp.js +1 -5
- package/out/languageFeatures/validation.js +31 -33
- package/out/languageFeatures/workspaceSymbols.js +9 -2
- package/out/plugin.d.ts +1 -1
- package/out/utils/featureWorkers.d.ts +2 -2
- package/out/utils/featureWorkers.js +1 -4
- package/package.json +7 -7
|
@@ -54,7 +54,7 @@ function createDocumentServiceContext(options) {
|
|
|
54
54
|
let sourceFile = languageModule.createSourceFile('/untitled.' + shared.languageIdToSyntax(document.languageId), ts.ScriptSnapshot.fromString(document.getText()));
|
|
55
55
|
if (sourceFile) {
|
|
56
56
|
sourceFile = (0, reactivity_1.shallowReactive)(sourceFile);
|
|
57
|
-
const sourceFileDoc = (0, documents_1.parseSourceFileDocument)(options.env.rootUri, sourceFile
|
|
57
|
+
const sourceFileDoc = (0, documents_1.parseSourceFileDocument)(options.env.rootUri, sourceFile);
|
|
58
58
|
cache = [sourceFileDoc, languageModule];
|
|
59
59
|
vueDocuments.set(document, cache);
|
|
60
60
|
fileMods.set(sourceFile, languageModule);
|
|
@@ -29,7 +29,7 @@ export declare function createLanguageService(context: LanguageServiceContext):
|
|
|
29
29
|
}>;
|
|
30
30
|
doCodeActions: (uri: string, range: _0.Range, codeActionContext: _0.CodeActionContext) => Promise<_0.CodeAction[] | undefined>;
|
|
31
31
|
doCodeActionResolve: (item: _0.CodeAction) => Promise<_0.CodeAction>;
|
|
32
|
-
doCompletionResolve: (item: _0.CompletionItem
|
|
32
|
+
doCompletionResolve: (item: _0.CompletionItem) => Promise<_0.CompletionItem>;
|
|
33
33
|
getSignatureHelp: (uri: string, position: _0.Position, signatureHelpContext?: _0.SignatureHelpContext | undefined) => Promise<_0.SignatureHelp | undefined>;
|
|
34
34
|
doCodeLens: (uri: string) => Promise<_0.CodeLens[]>;
|
|
35
35
|
doCodeLensResolve: (item: _0.CodeLens) => Promise<_0.CodeLens>;
|
|
@@ -84,8 +84,8 @@ function createLanguageService(context) {
|
|
|
84
84
|
doValidation: diagnostics.register(context),
|
|
85
85
|
findReferences: references.register(context),
|
|
86
86
|
findFileReferences: fileReferences.register(context),
|
|
87
|
-
findDefinition: definition.register(context, 'findDefinition', data => !!data.
|
|
88
|
-
findTypeDefinition: definition.register(context, 'findTypeDefinition', data => !!data.
|
|
87
|
+
findDefinition: definition.register(context, 'findDefinition', data => !!data.definition, data => !!data.definition),
|
|
88
|
+
findTypeDefinition: definition.register(context, 'findTypeDefinition', data => !!data.definition, data => !!data.definition),
|
|
89
89
|
findImplementations: definition.register(context, 'findImplementations', data => !!data.references, data => false),
|
|
90
90
|
prepareRename: renamePrepare.register(context),
|
|
91
91
|
doRename: rename.register(context),
|
|
@@ -3,17 +3,10 @@ exports.register = void 0;
|
|
|
3
3
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
4
4
|
function register(context) {
|
|
5
5
|
return (document, position, options) => {
|
|
6
|
-
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, position, sourceMap => true,
|
|
7
|
-
for (const [mappedRange] of sourceMap.getMappedRanges(position, position, data => !!data.completion)) {
|
|
8
|
-
yield mappedRange.start;
|
|
9
|
-
}
|
|
10
|
-
}, (plugin, document, position) => { var _a; return (_a = plugin.doAutoInsert) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position, options); }, (data, sourceMap) => {
|
|
11
|
-
var _a;
|
|
12
|
-
if (!sourceMap)
|
|
13
|
-
return data;
|
|
6
|
+
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, position, sourceMap => true, (position, sourceMap) => sourceMap.toGeneratedPositions(position, data => !!data.completion), (plugin, document, position) => { var _a; return (_a = plugin.doAutoInsert) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position, options); }, (data, sourceMap) => {
|
|
14
7
|
if (typeof data === 'string')
|
|
15
8
|
return data;
|
|
16
|
-
const range =
|
|
9
|
+
const range = sourceMap.toSourceRange(data.range);
|
|
17
10
|
if (range) {
|
|
18
11
|
data.range = range;
|
|
19
12
|
return data;
|
|
@@ -5,26 +5,19 @@ const shared = require("@volar/shared");
|
|
|
5
5
|
function register(context) {
|
|
6
6
|
return (document, color, range) => {
|
|
7
7
|
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, range, sourceMap => !!sourceMap.embeddedFile.capabilities.documentSymbol, // TODO: add color capabilitie setting
|
|
8
|
-
|
|
9
|
-
for (const [mappedRange] of sourceMap.getMappedRanges(range.start, range.end)) {
|
|
10
|
-
yield mappedRange;
|
|
11
|
-
}
|
|
12
|
-
}, (plugin, document, range) => { var _a; return (_a = plugin.getColorPresentations) === null || _a === void 0 ? void 0 : _a.call(plugin, document, color, range); }, (data, sourceMap) => data.map(cp => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
if (!sourceMap)
|
|
15
|
-
return cp;
|
|
8
|
+
(range, sourceMap) => sourceMap.toGeneratedRanges(range), (plugin, document, range) => { var _a; return (_a = plugin.getColorPresentations) === null || _a === void 0 ? void 0 : _a.call(plugin, document, color, range); }, (data, sourceMap) => data.map(cp => {
|
|
16
9
|
if (cp.textEdit) {
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
10
|
+
const range = sourceMap.toSourceRange(cp.textEdit.range);
|
|
11
|
+
if (!range)
|
|
19
12
|
return undefined;
|
|
20
|
-
cp.textEdit.range =
|
|
13
|
+
cp.textEdit.range = range;
|
|
21
14
|
}
|
|
22
15
|
if (cp.additionalTextEdits) {
|
|
23
16
|
for (const textEdit of cp.additionalTextEdits) {
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
17
|
+
const range = sourceMap.toSourceRange(textEdit.range);
|
|
18
|
+
if (!range)
|
|
26
19
|
return undefined;
|
|
27
|
-
textEdit.range =
|
|
20
|
+
textEdit.range = range;
|
|
28
21
|
}
|
|
29
22
|
}
|
|
30
23
|
return cp;
|
|
@@ -7,10 +7,7 @@ function register(context) {
|
|
|
7
7
|
return (document) => {
|
|
8
8
|
return (0, featureWorkers_1.documentFeatureWorker)(context, document, sourceMap => !!sourceMap.embeddedFile.capabilities.documentSymbol, // TODO: add color capabilitie setting
|
|
9
9
|
(plugin, document) => { var _a; return (_a = plugin.findDocumentColors) === null || _a === void 0 ? void 0 : _a.call(plugin, document); }, (data, sourceMap) => data.map(color => {
|
|
10
|
-
|
|
11
|
-
if (!sourceMap)
|
|
12
|
-
return color;
|
|
13
|
-
const range = (_a = sourceMap.getSourceRange(color.range.start, color.range.end)) === null || _a === void 0 ? void 0 : _a[0];
|
|
10
|
+
const range = sourceMap.toSourceRange(color.range);
|
|
14
11
|
if (range) {
|
|
15
12
|
return vscode.ColorInformation.create(range, color.color);
|
|
16
13
|
}
|
|
@@ -7,12 +7,9 @@ function register(context) {
|
|
|
7
7
|
return (document) => {
|
|
8
8
|
return (0, featureWorkers_1.documentFeatureWorker)(context, document, sourceMap => !!sourceMap.embeddedFile.capabilities.documentSymbol, // TODO: add color capabilitie setting
|
|
9
9
|
(plugin, document) => { var _a; return (_a = plugin.findDocumentSymbols) === null || _a === void 0 ? void 0 : _a.call(plugin, document); }, (data, sourceMap) => (0, transforms_1.transformSymbolInformations)(data, location => {
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
13
|
-
const sourceRange = (_a = sourceMap.getSourceRange(location.range.start, location.range.end)) === null || _a === void 0 ? void 0 : _a[0];
|
|
14
|
-
if (sourceRange) {
|
|
15
|
-
return vscode.Location.create(sourceMap.sourceDocument.uri, sourceRange);
|
|
10
|
+
const range = sourceMap.toSourceRange(location.range);
|
|
11
|
+
if (range) {
|
|
12
|
+
return vscode.Location.create(sourceMap.sourceDocument.uri, range);
|
|
16
13
|
}
|
|
17
14
|
}), arr => arr.flat());
|
|
18
15
|
};
|
|
@@ -4,12 +4,7 @@ const featureWorkers_1 = require("../utils/featureWorkers");
|
|
|
4
4
|
const transforms_1 = require("@volar/transforms");
|
|
5
5
|
function register(context) {
|
|
6
6
|
return (document) => {
|
|
7
|
-
return (0, featureWorkers_1.documentFeatureWorker)(context, document, sourceMap => !!sourceMap.embeddedFile.capabilities.
|
|
8
|
-
var _a;
|
|
9
|
-
if (!sourceMap)
|
|
10
|
-
return range;
|
|
11
|
-
return (_a = sourceMap.getSourceRange(range.start, range.end)) === null || _a === void 0 ? void 0 : _a[0];
|
|
12
|
-
}), arr => arr.flat());
|
|
7
|
+
return (0, featureWorkers_1.documentFeatureWorker)(context, document, sourceMap => !!sourceMap.embeddedFile.capabilities.foldingRange, (plugin, document) => { var _a; return (_a = plugin.getFoldingRanges) === null || _a === void 0 ? void 0 : _a.call(plugin, document); }, (data, sourceMap) => (0, transforms_1.transformFoldingRanges)(data, range => sourceMap === null || sourceMap === void 0 ? void 0 : sourceMap.toSourceRange(range)), arr => arr.flat());
|
|
13
8
|
};
|
|
14
9
|
}
|
|
15
10
|
exports.register = register;
|
|
@@ -14,7 +14,7 @@ const vscode_languageserver_textdocument_1 = require("vscode-languageserver-text
|
|
|
14
14
|
function register(context) {
|
|
15
15
|
const ts = context.typescript;
|
|
16
16
|
return (document, options, range, onTypeParams) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
var _a, _b
|
|
17
|
+
var _a, _b;
|
|
18
18
|
if (!range) {
|
|
19
19
|
range = vscode.Range.create(document.positionAt(0), document.positionAt(document.getText().length));
|
|
20
20
|
}
|
|
@@ -38,51 +38,44 @@ function register(context) {
|
|
|
38
38
|
let edits = [];
|
|
39
39
|
let toPatchIndent;
|
|
40
40
|
for (const embedded of embeddeds) {
|
|
41
|
-
if (!embedded.capabilities.
|
|
41
|
+
if (!embedded.capabilities.documentFormatting)
|
|
42
42
|
continue;
|
|
43
43
|
const sourceMap = vueDocument[0].getSourceMap(embedded);
|
|
44
|
-
const initialIndentBracket = typeof embedded.capabilities.
|
|
45
|
-
? embedded.capabilities.
|
|
44
|
+
const initialIndentBracket = typeof embedded.capabilities.documentFormatting === 'object' && initialIndentLanguageId[sourceMap.mappedDocument.languageId]
|
|
45
|
+
? embedded.capabilities.documentFormatting.initialIndentBracket
|
|
46
46
|
: undefined;
|
|
47
47
|
let _edits;
|
|
48
48
|
if (onTypeParams) {
|
|
49
|
-
const embeddedPosition =
|
|
49
|
+
const embeddedPosition = sourceMap.toGeneratedPosition(onTypeParams.position);
|
|
50
50
|
if (embeddedPosition) {
|
|
51
51
|
_edits = yield tryFormat(sourceMap.mappedDocument, embeddedPosition, initialIndentBracket, onTypeParams.ch);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
start
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (!end) {
|
|
66
|
-
const lastMapping = sourceMap.base.mappings.sort((a, b) => b.sourceRange.start - a.sourceRange.start)[0];
|
|
67
|
-
if (lastMapping && document.offsetAt(range.end) > lastMapping.sourceRange.end) {
|
|
68
|
-
end = sourceMap.mappedDocument.positionAt(lastMapping.mappedRange.end);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (start && end) {
|
|
72
|
-
embeddedRange = { start, end };
|
|
55
|
+
let genRange = sourceMap.toGeneratedRange(range);
|
|
56
|
+
if (!genRange) {
|
|
57
|
+
const firstMapping = sourceMap.mappings.sort((a, b) => a.sourceRange[0] - b.sourceRange[0])[0];
|
|
58
|
+
const lastMapping = sourceMap.mappings.sort((a, b) => b.sourceRange[0] - a.sourceRange[0])[0];
|
|
59
|
+
if (firstMapping && document.offsetAt(range.start) < firstMapping.sourceRange[0]
|
|
60
|
+
&& lastMapping && document.offsetAt(range.end) > lastMapping.sourceRange[1]) {
|
|
61
|
+
genRange = {
|
|
62
|
+
start: sourceMap.mappedDocument.positionAt(firstMapping.generatedRange[0]),
|
|
63
|
+
end: sourceMap.mappedDocument.positionAt(lastMapping.generatedRange[1]),
|
|
64
|
+
};
|
|
73
65
|
}
|
|
74
66
|
}
|
|
75
|
-
if (
|
|
67
|
+
if (genRange) {
|
|
76
68
|
toPatchIndent = {
|
|
77
69
|
sourceMapEmbeddedDocumentUri: sourceMap.mappedDocument.uri,
|
|
78
70
|
};
|
|
79
|
-
_edits = yield tryFormat(sourceMap.mappedDocument,
|
|
71
|
+
_edits = yield tryFormat(sourceMap.mappedDocument, genRange, initialIndentBracket);
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
74
|
if (!_edits)
|
|
83
75
|
continue;
|
|
84
76
|
for (const textEdit of _edits) {
|
|
85
|
-
|
|
77
|
+
const range = sourceMap.toSourceRange(textEdit.range);
|
|
78
|
+
if (range) {
|
|
86
79
|
edits.push({
|
|
87
80
|
newText: textEdit.newText,
|
|
88
81
|
range,
|
|
@@ -203,17 +196,17 @@ exports.register = register;
|
|
|
203
196
|
function patchInterpolationIndent(vueDocument, sourceMap) {
|
|
204
197
|
const indentTextEdits = [];
|
|
205
198
|
const document = vueDocument.getDocument();
|
|
206
|
-
for (const mapped of sourceMap.
|
|
199
|
+
for (const mapped of sourceMap.mappings) {
|
|
207
200
|
const textRange = {
|
|
208
|
-
start: document.positionAt(mapped.sourceRange
|
|
209
|
-
end: document.positionAt(mapped.sourceRange
|
|
201
|
+
start: document.positionAt(mapped.sourceRange[0]),
|
|
202
|
+
end: document.positionAt(mapped.sourceRange[1]),
|
|
210
203
|
};
|
|
211
204
|
const text = document.getText(textRange);
|
|
212
205
|
if (text.indexOf('\n') === -1)
|
|
213
206
|
continue;
|
|
214
207
|
const lines = text.split('\n');
|
|
215
208
|
const removeIndent = getRemoveIndent(lines);
|
|
216
|
-
const baseIndent = getBaseIndent(mapped.sourceRange
|
|
209
|
+
const baseIndent = getBaseIndent(mapped.sourceRange[0]);
|
|
217
210
|
for (let i = 1; i < lines.length; i++) {
|
|
218
211
|
const line = lines[i];
|
|
219
212
|
if (line.startsWith(removeIndent)) {
|
|
@@ -4,18 +4,9 @@ const featureWorkers_1 = require("../utils/featureWorkers");
|
|
|
4
4
|
const shared = require("@volar/shared");
|
|
5
5
|
function register(context) {
|
|
6
6
|
return (document, position) => {
|
|
7
|
-
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, position, sourceMap => true,
|
|
8
|
-
for (const [mappedRange] of sourceMap.getMappedRanges(position, position, data => !!data.completion)) {
|
|
9
|
-
yield mappedRange.start;
|
|
10
|
-
}
|
|
11
|
-
}, (plugin, document, position) => { var _a; return (_a = plugin.findLinkedEditingRanges) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position); }, (data, sourceMap) => ({
|
|
7
|
+
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, position, sourceMap => true, (position, sourceMap) => sourceMap.toGeneratedPositions(position, data => !!data.completion), (plugin, document, position) => { var _a; return (_a = plugin.findLinkedEditingRanges) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position); }, (data, sourceMap) => ({
|
|
12
8
|
wordPattern: data.wordPattern,
|
|
13
|
-
ranges: data.ranges.map(range =>
|
|
14
|
-
var _a;
|
|
15
|
-
if (!sourceMap)
|
|
16
|
-
return range;
|
|
17
|
-
return (_a = sourceMap.getSourceRange(range.start, range.end)) === null || _a === void 0 ? void 0 : _a[0];
|
|
18
|
-
}).filter(shared.notEmpty),
|
|
9
|
+
ranges: data.ranges.map(range => sourceMap.toSourceRange(range)).filter(shared.notEmpty),
|
|
19
10
|
}));
|
|
20
11
|
};
|
|
21
12
|
}
|
|
@@ -5,14 +5,9 @@ const transforms_1 = require("@volar/transforms");
|
|
|
5
5
|
const shared = require("@volar/shared");
|
|
6
6
|
function register(context) {
|
|
7
7
|
return (document, positions) => {
|
|
8
|
-
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, positions, sourceMap => !!sourceMap.embeddedFile.capabilities.
|
|
9
|
-
.map(position =>
|
|
10
|
-
.filter(shared.notEmpty)], (plugin, document, positions) => { var _a; return positions.length ? (_a = plugin.getSelectionRanges) === null || _a === void 0 ? void 0 : _a.call(plugin, document, positions) : undefined; }, (
|
|
11
|
-
var _a;
|
|
12
|
-
if (!sourceMap)
|
|
13
|
-
return range;
|
|
14
|
-
return (_a = sourceMap.getSourceRange(range.start, range.end)) === null || _a === void 0 ? void 0 : _a[0];
|
|
15
|
-
}));
|
|
8
|
+
return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, positions, sourceMap => !!sourceMap.embeddedFile.capabilities.foldingRange, (positions, sourceMap) => [positions
|
|
9
|
+
.map(position => sourceMap.toGeneratedPosition(position))
|
|
10
|
+
.filter(shared.notEmpty)], (plugin, document, positions) => { var _a; return positions.length ? (_a = plugin.getSelectionRanges) === null || _a === void 0 ? void 0 : _a.call(plugin, document, positions) : undefined; }, (item, sourceMap) => (0, transforms_1.transformSelectionRanges)(item, range => sourceMap.toSourceRange(range)));
|
|
16
11
|
};
|
|
17
12
|
}
|
|
18
13
|
exports.register = register;
|
package/out/documents.d.ts
CHANGED
|
@@ -1,51 +1,42 @@
|
|
|
1
|
-
import { DocumentRegistry,
|
|
1
|
+
import { DocumentRegistry, EmbeddedFile, PositionCapabilities, SourceFile, TeleportMappingData } from '@volar/language-core';
|
|
2
2
|
import * as shared from '@volar/shared';
|
|
3
|
-
import { SourceMapBase } from '@volar/source-map';
|
|
3
|
+
import { Mapping, SourceMapBase } from '@volar/source-map';
|
|
4
4
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
5
5
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
6
6
|
import { URI } from 'vscode-uri';
|
|
7
7
|
export type SourceFileDocuments = ReturnType<typeof parseSourceFileDocuments>;
|
|
8
8
|
export type SourceFileDocument = ReturnType<typeof parseSourceFileDocument>;
|
|
9
|
-
export declare class SourceMap<Data = undefined> {
|
|
9
|
+
export declare class SourceMap<Data = undefined> extends SourceMapBase<Data> {
|
|
10
10
|
sourceDocument: TextDocument;
|
|
11
11
|
mappedDocument: TextDocument;
|
|
12
|
-
|
|
13
|
-
constructor(sourceDocument: TextDocument, mappedDocument: TextDocument,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end: T;
|
|
29
|
-
}, Data], void, unknown>;
|
|
30
|
-
protected getRanges<T extends number | vscode.Position>(start: T, end: T, sourceToTarget: boolean, filter?: (data: Data) => boolean): Generator<[{
|
|
31
|
-
start: T;
|
|
32
|
-
end: T;
|
|
33
|
-
}, Data], void, unknown>;
|
|
12
|
+
mappings: Mapping<Data>[];
|
|
13
|
+
constructor(sourceDocument: TextDocument, mappedDocument: TextDocument, mappings: Mapping<Data>[]);
|
|
14
|
+
toSourceRange(range: vscode.Range, filter?: (data: Data) => boolean): vscode.Range | undefined;
|
|
15
|
+
toGeneratedRange(range: vscode.Range, filter?: (data: Data) => boolean): vscode.Range | undefined;
|
|
16
|
+
toSourceRanges(range: vscode.Range, filter?: (data: Data) => boolean): Generator<vscode.Range, void, unknown>;
|
|
17
|
+
toGeneratedRanges(range: vscode.Range, filter?: (data: Data) => boolean): Generator<vscode.Range, void, unknown>;
|
|
18
|
+
protected toRanges(range: vscode.Range, filter: (data: Data) => boolean, api: 'toSourcePositionsBase' | 'toGeneratedPositionsBase', api2: 'matchSourcePosition' | 'matchGeneratedPosition'): Generator<vscode.Range, void, unknown>;
|
|
19
|
+
toSourcePosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared._0.Position | undefined;
|
|
20
|
+
toGeneratedPosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared._0.Position | undefined;
|
|
21
|
+
toSourcePositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared._0.Position, void, unknown>;
|
|
22
|
+
toGeneratedPositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared._0.Position, void, unknown>;
|
|
23
|
+
toSourcePositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared._0.Position, Mapping<Data>], void, unknown>;
|
|
24
|
+
toGeneratedPositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared._0.Position, Mapping<Data>], void, unknown>;
|
|
25
|
+
protected toPositions(position: vscode.Position, filter: (data: Data) => boolean, fromDoc: TextDocument, toDoc: TextDocument, from: 'sourceRange' | 'generatedRange', to: 'sourceRange' | 'generatedRange', baseOffset: 'left' | 'right'): Generator<readonly [shared._0.Position, Mapping<Data>], void, unknown>;
|
|
26
|
+
protected matchSourcePosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared._0.Position | undefined;
|
|
27
|
+
protected matchGeneratedPosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared._0.Position | undefined;
|
|
34
28
|
}
|
|
35
29
|
export declare class EmbeddedDocumentSourceMap extends SourceMap<PositionCapabilities> {
|
|
36
30
|
embeddedFile: EmbeddedFile;
|
|
37
31
|
sourceDocument: TextDocument;
|
|
38
32
|
mappedDocument: TextDocument;
|
|
39
|
-
constructor(embeddedFile: EmbeddedFile, sourceDocument: TextDocument, mappedDocument: TextDocument,
|
|
33
|
+
constructor(embeddedFile: EmbeddedFile, sourceDocument: TextDocument, mappedDocument: TextDocument, mappings: Mapping<PositionCapabilities>[]);
|
|
40
34
|
}
|
|
41
35
|
export declare class TeleportSourceMap extends SourceMap<TeleportMappingData> {
|
|
42
36
|
embeddedFile: EmbeddedFile;
|
|
43
37
|
document: TextDocument;
|
|
44
|
-
constructor(embeddedFile: EmbeddedFile, document: TextDocument,
|
|
45
|
-
findTeleports(start: vscode.Position
|
|
46
|
-
start: vscode.Position;
|
|
47
|
-
end: vscode.Position;
|
|
48
|
-
}, TeleportCapabilities], void, unknown>;
|
|
38
|
+
constructor(embeddedFile: EmbeddedFile, document: TextDocument, mappings: Mapping<TeleportMappingData>[]);
|
|
39
|
+
findTeleports(start: vscode.Position): Generator<readonly [shared._0.Position, import("@volar/language-core").TeleportCapabilities], void, unknown>;
|
|
49
40
|
}
|
|
50
41
|
export declare function parseSourceFileDocuments(rootUri: URI, mapper: DocumentRegistry): {
|
|
51
42
|
getAll: () => {
|
|
@@ -77,25 +68,8 @@ export declare function parseSourceFileDocuments(rootUri: URI, mapper: DocumentR
|
|
|
77
68
|
} | undefined;
|
|
78
69
|
sourceMapFromEmbeddedDocumentUri: (uri: string) => EmbeddedDocumentSourceMap | undefined;
|
|
79
70
|
teleportfromEmbeddedDocumentUri: (uri: string) => TeleportSourceMap | undefined;
|
|
80
|
-
fromEmbeddedLocation: (uri: string, start: vscode.Position, end?: vscode.Position, filter?: ((data: PositionCapabilities) => boolean) | undefined, sourceMapFilter?: ((sourceMap: EmbeddedFileSourceMap) => boolean) | undefined) => Generator<{
|
|
81
|
-
uri: string;
|
|
82
|
-
range: {
|
|
83
|
-
start: vscode.Position;
|
|
84
|
-
end: vscode.Position;
|
|
85
|
-
};
|
|
86
|
-
sourceMap: EmbeddedDocumentSourceMap;
|
|
87
|
-
data: PositionCapabilities;
|
|
88
|
-
} | {
|
|
89
|
-
uri: string;
|
|
90
|
-
range: {
|
|
91
|
-
start: vscode.Position;
|
|
92
|
-
end: vscode.Position;
|
|
93
|
-
};
|
|
94
|
-
sourceMap?: undefined;
|
|
95
|
-
data?: undefined;
|
|
96
|
-
}, void, unknown>;
|
|
97
71
|
};
|
|
98
|
-
export declare function parseSourceFileDocument(rootUri: URI, sourceFile: SourceFile
|
|
72
|
+
export declare function parseSourceFileDocument(rootUri: URI, sourceFile: SourceFile): {
|
|
99
73
|
uri: string;
|
|
100
74
|
file: SourceFile;
|
|
101
75
|
getSourceMap: (embedded: EmbeddedFile) => EmbeddedDocumentSourceMap;
|