@volar/language-service 2.2.4 → 2.3.0-alpha.0
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 +1 -2
- package/index.js +2 -41
- package/lib/documents.d.ts +20 -18
- package/lib/documents.js +7 -5
- package/lib/features/provideAutoInsertSnippet.d.ts +8 -0
- package/lib/features/{provideAutoInsertionEdit.js → provideAutoInsertSnippet.js} +6 -15
- package/lib/features/provideCallHierarchyItems.d.ts +5 -4
- package/lib/features/provideCallHierarchyItems.js +18 -17
- package/lib/features/provideCodeActions.d.ts +4 -3
- package/lib/features/provideCodeActions.js +9 -9
- package/lib/features/provideCodeLenses.d.ts +4 -3
- package/lib/features/provideCodeLenses.js +9 -9
- package/lib/features/provideColorPresentations.d.ts +3 -2
- package/lib/features/provideColorPresentations.js +5 -5
- package/lib/features/provideCompletionItems.d.ts +4 -3
- package/lib/features/provideCompletionItems.js +26 -25
- package/lib/features/provideDefinition.d.ts +3 -2
- package/lib/features/provideDefinition.js +6 -5
- package/lib/features/provideDiagnostics.d.ts +4 -3
- package/lib/features/provideDiagnostics.js +13 -11
- package/lib/features/provideDocumentColors.d.ts +3 -2
- package/lib/features/provideDocumentColors.js +2 -2
- package/lib/features/provideDocumentDropEdits.d.ts +3 -2
- package/lib/features/provideDocumentDropEdits.js +3 -3
- package/lib/features/provideDocumentFormattingEdits.d.ts +3 -2
- package/lib/features/provideDocumentFormattingEdits.js +18 -16
- package/lib/features/provideDocumentHighlights.d.ts +3 -2
- package/lib/features/provideDocumentHighlights.js +9 -8
- package/lib/features/provideDocumentLinks.d.ts +4 -3
- package/lib/features/provideDocumentLinks.js +6 -6
- package/lib/features/provideDocumentSemanticTokens.d.ts +3 -2
- package/lib/features/provideDocumentSemanticTokens.js +3 -3
- package/lib/features/provideDocumentSymbols.d.ts +3 -2
- package/lib/features/provideDocumentSymbols.js +5 -5
- package/lib/features/provideFileReferences.d.ts +3 -2
- package/lib/features/provideFileReferences.js +8 -7
- package/lib/features/provideFileRenameEdits.d.ts +3 -2
- package/lib/features/provideFileRenameEdits.js +6 -6
- package/lib/features/provideFoldingRanges.d.ts +3 -2
- package/lib/features/provideFoldingRanges.js +4 -4
- package/lib/features/provideHover.d.ts +3 -2
- package/lib/features/provideHover.js +7 -7
- package/lib/features/provideInlayHints.d.ts +4 -3
- package/lib/features/provideInlayHints.js +6 -6
- package/lib/features/provideLinkedEditingRanges.d.ts +3 -2
- package/lib/features/provideLinkedEditingRanges.js +5 -5
- package/lib/features/provideReferences.d.ts +3 -2
- package/lib/features/provideReferences.js +9 -8
- package/lib/features/provideRenameEdits.d.ts +3 -2
- package/lib/features/provideRenameEdits.js +5 -4
- package/lib/features/provideRenameRange.d.ts +3 -2
- package/lib/features/provideRenameRange.js +4 -4
- package/lib/features/provideSelectionRanges.d.ts +3 -2
- package/lib/features/provideSelectionRanges.js +3 -3
- package/lib/features/provideSignatureHelp.d.ts +3 -2
- package/lib/features/provideSignatureHelp.js +6 -6
- package/lib/features/provideWorkspaceSymbols.d.ts +2 -2
- package/lib/features/provideWorkspaceSymbols.js +6 -5
- package/lib/features/resolveCodeAction.d.ts +2 -2
- package/lib/features/resolveCodeAction.js +4 -4
- package/lib/features/resolveCodeLens.d.ts +2 -2
- package/lib/features/resolveCodeLens.js +6 -5
- package/lib/features/resolveCompletionItem.d.ts +2 -2
- package/lib/features/resolveCompletionItem.js +7 -6
- package/lib/features/resolveDocumentLink.d.ts +2 -2
- package/lib/features/resolveDocumentLink.js +4 -4
- package/lib/features/resolveInlayHint.d.ts +2 -2
- package/lib/features/resolveInlayHint.js +3 -3
- package/lib/languageService.d.ts +37 -32
- package/lib/languageService.js +42 -29
- package/lib/types.d.ts +77 -36
- package/lib/utils/common.js +6 -12
- package/lib/utils/dedupe.d.ts +1 -1
- package/lib/utils/featureWorkers.d.ts +7 -6
- package/lib/utils/featureWorkers.js +25 -18
- package/lib/utils/transform.d.ts +7 -6
- package/lib/utils/transform.js +18 -15
- package/lib/utils/uriMap.d.ts +3 -0
- package/lib/utils/uriMap.js +69 -0
- package/package.json +3 -3
- package/lib/features/provideAutoInsertionEdit.d.ts +0 -7
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const references = require("./provideReferences");
|
|
6
7
|
function register(context) {
|
|
7
8
|
const findReferences = references.register(context);
|
|
8
9
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
9
10
|
const data = item.data;
|
|
10
11
|
if (data?.kind === 'normal') {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
12
|
+
const plugin = context.plugins[data.pluginIndex];
|
|
13
|
+
if (!plugin[1].resolveCodeLens) {
|
|
13
14
|
return item;
|
|
14
15
|
}
|
|
15
16
|
Object.assign(item, data.original);
|
|
16
|
-
item = await
|
|
17
|
+
item = await plugin[1].resolveCodeLens(item, token);
|
|
17
18
|
// item.range already transformed in codeLens request
|
|
18
19
|
}
|
|
19
20
|
if (data?.kind === 'references') {
|
|
20
|
-
const references = await findReferences(data.sourceFileUri, item.range.start, { includeDeclaration: false }, token) ?? [];
|
|
21
|
+
const references = await findReferences(vscode_uri_1.URI.parse(data.sourceFileUri), item.range.start, { includeDeclaration: false }, token) ?? [];
|
|
21
22
|
item.command = context.commands.showReferences.create(data.sourceFileUri, item.range.start, references);
|
|
22
23
|
}
|
|
23
24
|
return item;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
@@ -3,28 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
5
|
const transform_1 = require("../utils/transform");
|
|
6
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
6
7
|
function register(context) {
|
|
7
8
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
8
9
|
const data = item.data;
|
|
9
10
|
if (data) {
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
11
|
+
const plugin = context.plugins[data.pluginIndex];
|
|
12
|
+
if (!plugin[1].resolveCompletionItem) {
|
|
12
13
|
return item;
|
|
13
14
|
}
|
|
14
15
|
item = Object.assign(item, data.original);
|
|
15
16
|
if (data.embeddedDocumentUri) {
|
|
16
|
-
const decoded = context.decodeEmbeddedDocumentUri(data.embeddedDocumentUri);
|
|
17
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(data.embeddedDocumentUri));
|
|
17
18
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
18
19
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
19
20
|
if (virtualCode) {
|
|
20
21
|
for (const map of context.documents.getMaps(virtualCode)) {
|
|
21
|
-
item = await
|
|
22
|
-
item =
|
|
22
|
+
item = await plugin[1].resolveCompletionItem(item, token);
|
|
23
|
+
item = plugin[1].transformCompletionItem?.(item) ?? (0, transform_1.transformCompletionItem)(item, embeddedRange => map.getSourceRange(embeddedRange), map.embeddedDocument, context);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
27
|
-
item = await
|
|
28
|
+
item = await plugin[1].resolveCompletionItem(item, token);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
// TODO: monkey fix import ts file icon
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
@@ -7,14 +7,14 @@ function register(context) {
|
|
|
7
7
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
8
8
|
const data = item.data;
|
|
9
9
|
if (data) {
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
10
|
+
const plugin = context.plugins[data.pluginIndex];
|
|
11
|
+
if (!plugin[1].resolveDocumentLink) {
|
|
12
12
|
return item;
|
|
13
13
|
}
|
|
14
14
|
Object.assign(item, data.original);
|
|
15
|
-
item = await
|
|
15
|
+
item = await plugin[1].resolveDocumentLink(item, token);
|
|
16
16
|
if (item.target) {
|
|
17
|
-
item.target = (0, transform_1.transformDocumentLinkTarget)(item.target, context);
|
|
17
|
+
item.target = (0, transform_1.transformDocumentLinkTarget)(item.target, context).toString();
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return item;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
@@ -6,12 +6,12 @@ function register(context) {
|
|
|
6
6
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
7
7
|
const data = item.data;
|
|
8
8
|
if (data) {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
9
|
+
const plugin = context.plugins[data.pluginIndex];
|
|
10
|
+
if (!plugin[1].resolveInlayHint) {
|
|
11
11
|
return item;
|
|
12
12
|
}
|
|
13
13
|
Object.assign(item, data.original);
|
|
14
|
-
item = await
|
|
14
|
+
item = await plugin[1].resolveInlayHint(item, token);
|
|
15
15
|
}
|
|
16
16
|
return item;
|
|
17
17
|
};
|
package/lib/languageService.d.ts
CHANGED
|
@@ -1,62 +1,67 @@
|
|
|
1
1
|
import { type Language } from '@volar/language-core';
|
|
2
2
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
import
|
|
3
|
+
import { URI } from 'vscode-uri';
|
|
4
|
+
import type { LanguageServicePlugin, LanguageServiceContext, LanguageServiceEnvironment } from './types';
|
|
4
5
|
export type LanguageService = ReturnType<typeof createLanguageService>;
|
|
5
|
-
export declare function createLanguageService(language: Language
|
|
6
|
+
export declare function createLanguageService(language: Language<URI>, plugins: LanguageServicePlugin[], env: LanguageServiceEnvironment): {
|
|
7
|
+
getSemanticTokenLegend: () => {
|
|
8
|
+
tokenModifiers: string[];
|
|
9
|
+
tokenTypes: string[];
|
|
10
|
+
};
|
|
6
11
|
getTriggerCharacters: () => string[];
|
|
7
12
|
getAutoFormatTriggerCharacters: () => string[];
|
|
8
13
|
getSignatureHelpTriggerCharacters: () => string[];
|
|
9
14
|
getSignatureHelpRetriggerCharacters: () => string[];
|
|
10
|
-
format: (uri:
|
|
15
|
+
format: (uri: URI, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
11
16
|
ch: string;
|
|
12
17
|
position: vscode.Position;
|
|
13
18
|
} | undefined, token?: vscode.CancellationToken) => Promise<vscode.TextEdit[] | undefined>;
|
|
14
|
-
getFoldingRanges: (uri:
|
|
15
|
-
getSelectionRanges: (uri:
|
|
16
|
-
findLinkedEditingRanges: (uri:
|
|
17
|
-
findDocumentSymbols: (uri:
|
|
18
|
-
findDocumentColors: (uri:
|
|
19
|
-
getColorPresentations: (uri:
|
|
20
|
-
doValidation: (uri:
|
|
21
|
-
findReferences: (uri:
|
|
22
|
-
findFileReferences: (uri:
|
|
23
|
-
findDefinition: (uri:
|
|
24
|
-
findTypeDefinition: (uri:
|
|
25
|
-
findImplementations: (uri:
|
|
26
|
-
prepareRename: (uri:
|
|
19
|
+
getFoldingRanges: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.FoldingRange[] | undefined>;
|
|
20
|
+
getSelectionRanges: (uri: URI, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
21
|
+
findLinkedEditingRanges: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
22
|
+
findDocumentSymbols: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
23
|
+
findDocumentColors: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
24
|
+
getColorPresentations: (uri: URI, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
25
|
+
doValidation: (uri: URI, token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
|
|
26
|
+
findReferences: (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
27
|
+
findFileReferences: (uri: URI, token?: vscode.CancellationToken) => import("./types").NullableProviderResult<vscode.Location[]>;
|
|
28
|
+
findDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
29
|
+
findTypeDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
30
|
+
findImplementations: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
31
|
+
prepareRename: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Range | {
|
|
27
32
|
range: vscode.Range;
|
|
28
33
|
placeholder: string;
|
|
29
34
|
} | {
|
|
30
35
|
message: string;
|
|
31
36
|
} | undefined>;
|
|
32
|
-
doRename: (uri:
|
|
33
|
-
getEditsForFileRename: (oldUri:
|
|
34
|
-
getSemanticTokens: (uri:
|
|
35
|
-
doHover: (uri:
|
|
36
|
-
doComplete: (uri:
|
|
37
|
-
doCodeActions: (uri:
|
|
37
|
+
doRename: (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
38
|
+
getEditsForFileRename: (oldUri: URI, newUri: URI, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
39
|
+
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: ((tokens: vscode.SemanticTokens) => void) | undefined) => Promise<vscode.SemanticTokens | undefined>;
|
|
40
|
+
doHover: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
41
|
+
doComplete: (uri: URI, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
42
|
+
doCodeActions: (uri: URI, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
38
43
|
doCodeActionResolve: (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
39
44
|
doCompletionResolve: (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
40
|
-
getSignatureHelp: (uri:
|
|
41
|
-
doCodeLens: (uri:
|
|
45
|
+
getSignatureHelp: (uri: URI, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
46
|
+
doCodeLens: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
|
|
42
47
|
doCodeLensResolve: (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
43
|
-
findDocumentHighlights: (uri:
|
|
44
|
-
findDocumentLinks: (uri:
|
|
48
|
+
findDocumentHighlights: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
49
|
+
findDocumentLinks: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
|
|
45
50
|
doDocumentLinkResolve: (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
46
51
|
findWorkspaceSymbols: (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
47
|
-
doAutoInsert: (uri:
|
|
52
|
+
doAutoInsert: (uri: URI, selection: vscode.Position, change: {
|
|
48
53
|
rangeOffset: number;
|
|
49
54
|
rangeLength: number;
|
|
50
55
|
text: string;
|
|
51
|
-
}, token?: vscode.CancellationToken) => Promise<string |
|
|
52
|
-
doDocumentDrop: (uri:
|
|
53
|
-
getInlayHints: (uri:
|
|
56
|
+
}, token?: vscode.CancellationToken) => Promise<string | undefined>;
|
|
57
|
+
doDocumentDrop: (uri: URI, position: vscode.Position, dataTransfer: Map<string, import("./types").DataTransferItem>, token?: vscode.CancellationToken) => Promise<import("./types").DocumentDropEdit | undefined>;
|
|
58
|
+
getInlayHints: (uri: URI, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
54
59
|
doInlayHintResolve: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
55
60
|
callHierarchy: {
|
|
56
|
-
doPrepare(uri:
|
|
61
|
+
doPrepare(uri: URI, position: vscode.Position, token?: vscode.CancellationToken): Promise<vscode.CallHierarchyItem[] | undefined>;
|
|
57
62
|
getIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[]>;
|
|
58
63
|
getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
59
64
|
};
|
|
60
65
|
dispose: () => void;
|
|
61
|
-
context:
|
|
66
|
+
context: LanguageServiceContext;
|
|
62
67
|
};
|
package/lib/languageService.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLanguageService = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
7
|
const documents_1 = require("./documents");
|
|
6
|
-
const autoInsert = require("./features/
|
|
8
|
+
const autoInsert = require("./features/provideAutoInsertSnippet");
|
|
7
9
|
const callHierarchy = require("./features/provideCallHierarchyItems");
|
|
8
10
|
const codeActions = require("./features/provideCodeActions");
|
|
9
11
|
const codeLens = require("./features/provideCodeLenses");
|
|
@@ -35,9 +37,9 @@ const codeLensResolve = require("./features/resolveCodeLens");
|
|
|
35
37
|
const completionResolve = require("./features/resolveCompletionItem");
|
|
36
38
|
const documentLinkResolve = require("./features/resolveDocumentLink");
|
|
37
39
|
const inlayHintResolve = require("./features/resolveInlayHint");
|
|
38
|
-
const
|
|
39
|
-
function createLanguageService(language,
|
|
40
|
-
const documentVersions =
|
|
40
|
+
const uriMap_1 = require("./utils/uriMap");
|
|
41
|
+
function createLanguageService(language, plugins, env) {
|
|
42
|
+
const documentVersions = (0, uriMap_1.createUriMap)();
|
|
41
43
|
const map2DocMap = new WeakMap();
|
|
42
44
|
const mirrorMap2DocMirrorMap = new WeakMap();
|
|
43
45
|
const snapshot2Doc = new WeakMap();
|
|
@@ -47,13 +49,13 @@ function createLanguageService(language, servicePlugins, env) {
|
|
|
47
49
|
documents: {
|
|
48
50
|
get(uri, languageId, snapshot) {
|
|
49
51
|
if (!snapshot2Doc.has(snapshot)) {
|
|
50
|
-
snapshot2Doc.set(snapshot,
|
|
52
|
+
snapshot2Doc.set(snapshot, (0, uriMap_1.createUriMap)());
|
|
51
53
|
}
|
|
52
54
|
const map = snapshot2Doc.get(snapshot);
|
|
53
55
|
if (!map.has(uri)) {
|
|
54
56
|
const version = documentVersions.get(uri) ?? 0;
|
|
55
57
|
documentVersions.set(uri, version + 1);
|
|
56
|
-
map.set(uri, vscode_languageserver_textdocument_1.TextDocument.create(uri, languageId, version, snapshot.getText(0, snapshot.getLength())));
|
|
58
|
+
map.set(uri, vscode_languageserver_textdocument_1.TextDocument.create(uri.toString(), languageId, version, snapshot.getText(0, snapshot.getLength())));
|
|
57
59
|
}
|
|
58
60
|
return map.get(uri);
|
|
59
61
|
},
|
|
@@ -61,17 +63,17 @@ function createLanguageService(language, servicePlugins, env) {
|
|
|
61
63
|
for (const [uri, [snapshot, map]] of context.language.maps.forEach(virtualCode)) {
|
|
62
64
|
if (!map2DocMap.has(map)) {
|
|
63
65
|
const embeddedUri = context.encodeEmbeddedDocumentUri(uri, virtualCode.id);
|
|
64
|
-
map2DocMap.set(map, new documents_1.SourceMapWithDocuments(this.get(uri, context.language.scripts.get(uri).languageId, snapshot), this.get(embeddedUri, virtualCode.languageId, virtualCode.snapshot), map));
|
|
66
|
+
map2DocMap.set(map, new documents_1.SourceMapWithDocuments(this.get(uri, context.language.scripts.get(uri).languageId, snapshot), this.get(embeddedUri, virtualCode.languageId, virtualCode.snapshot), map, virtualCode));
|
|
65
67
|
}
|
|
66
68
|
yield map2DocMap.get(map);
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
|
-
getLinkedCodeMap(virtualCode,
|
|
71
|
+
getLinkedCodeMap(virtualCode, documentUri) {
|
|
70
72
|
const map = context.language.linkedCodeMaps.get(virtualCode);
|
|
71
73
|
if (map) {
|
|
72
74
|
if (!mirrorMap2DocMirrorMap.has(map)) {
|
|
73
|
-
const embeddedUri = context.encodeEmbeddedDocumentUri(
|
|
74
|
-
mirrorMap2DocMirrorMap.set(map, new documents_1.LinkedCodeMapWithDocument(this.get(embeddedUri, virtualCode.languageId, virtualCode.snapshot), map));
|
|
75
|
+
const embeddedUri = context.encodeEmbeddedDocumentUri(documentUri, virtualCode.id);
|
|
76
|
+
mirrorMap2DocMirrorMap.set(map, new documents_1.LinkedCodeMapWithDocument(this.get(embeddedUri, virtualCode.languageId, virtualCode.snapshot), map, virtualCode));
|
|
75
77
|
}
|
|
76
78
|
return mirrorMap2DocMirrorMap.get(map);
|
|
77
79
|
}
|
|
@@ -79,17 +81,17 @@ function createLanguageService(language, servicePlugins, env) {
|
|
|
79
81
|
},
|
|
80
82
|
env,
|
|
81
83
|
inject: (key, ...args) => {
|
|
82
|
-
for (const
|
|
83
|
-
if (context.disabledServicePlugins.has(
|
|
84
|
+
for (const plugin of context.plugins) {
|
|
85
|
+
if (context.disabledServicePlugins.has(plugin[1])) {
|
|
84
86
|
continue;
|
|
85
87
|
}
|
|
86
|
-
const provide =
|
|
88
|
+
const provide = plugin[1].provide?.[key];
|
|
87
89
|
if (provide) {
|
|
88
90
|
return provide(...args);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
},
|
|
92
|
-
|
|
94
|
+
plugins: [],
|
|
93
95
|
commands: {
|
|
94
96
|
rename: {
|
|
95
97
|
create(uri, position) {
|
|
@@ -142,28 +144,39 @@ function createLanguageService(language, servicePlugins, env) {
|
|
|
142
144
|
},
|
|
143
145
|
},
|
|
144
146
|
},
|
|
145
|
-
disabledEmbeddedDocumentUris:
|
|
147
|
+
disabledEmbeddedDocumentUris: (0, uriMap_1.createUriMap)(),
|
|
146
148
|
disabledServicePlugins: new WeakSet(),
|
|
147
149
|
decodeEmbeddedDocumentUri(maybeEmbeddedContentUri) {
|
|
148
|
-
if (maybeEmbeddedContentUri.
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const documentUri = trimed.substring(embeddedCodeId.length + 1);
|
|
150
|
+
if (maybeEmbeddedContentUri.scheme === embeddedContentScheme) {
|
|
151
|
+
const embeddedCodeId = decodeURIComponent(maybeEmbeddedContentUri.authority);
|
|
152
|
+
const documentUri = decodeURIComponent(maybeEmbeddedContentUri.path.substring(1));
|
|
152
153
|
return [
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
vscode_uri_1.URI.parse(documentUri),
|
|
155
|
+
embeddedCodeId,
|
|
155
156
|
];
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
159
|
encodeEmbeddedDocumentUri(documentUri, embeddedContentId) {
|
|
159
|
-
return
|
|
160
|
+
return vscode_uri_1.URI.from({
|
|
161
|
+
scheme: embeddedContentScheme,
|
|
162
|
+
authority: encodeURIComponent(embeddedContentId),
|
|
163
|
+
path: '/' + encodeURIComponent(documentUri.toString()),
|
|
164
|
+
});
|
|
160
165
|
},
|
|
161
166
|
};
|
|
162
167
|
const api = {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
getSemanticTokenLegend: () => {
|
|
169
|
+
const tokenModifiers = plugins.map(plugin => plugin.capabilities.semanticTokensProvider?.legend?.tokenModifiers ?? []).flat();
|
|
170
|
+
const tokenTypes = plugins.map(plugin => plugin.capabilities.semanticTokensProvider?.legend?.tokenTypes ?? []).flat();
|
|
171
|
+
return {
|
|
172
|
+
tokenModifiers: [...new Set(tokenModifiers)],
|
|
173
|
+
tokenTypes: [...new Set(tokenTypes)],
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
getTriggerCharacters: () => plugins.map(plugin => plugin.capabilities.completionProvider?.triggerCharacters ?? []).flat(),
|
|
177
|
+
getAutoFormatTriggerCharacters: () => plugins.map(plugin => plugin.capabilities.documentOnTypeFormattingProvider?.triggerCharacters ?? []).flat(),
|
|
178
|
+
getSignatureHelpTriggerCharacters: () => plugins.map(plugin => plugin.capabilities.signatureHelpProvider?.triggerCharacters ?? []).flat(),
|
|
179
|
+
getSignatureHelpRetriggerCharacters: () => plugins.map(plugin => plugin.capabilities.signatureHelpProvider?.retriggerCharacters ?? []).flat(),
|
|
167
180
|
format: format.register(context),
|
|
168
181
|
getFoldingRanges: foldingRanges.register(context),
|
|
169
182
|
getSelectionRanges: selectionRanges.register(context),
|
|
@@ -198,11 +211,11 @@ function createLanguageService(language, servicePlugins, env) {
|
|
|
198
211
|
getInlayHints: inlayHints.register(context),
|
|
199
212
|
doInlayHintResolve: inlayHintResolve.register(context),
|
|
200
213
|
callHierarchy: callHierarchy.register(context),
|
|
201
|
-
dispose: () => context.
|
|
214
|
+
dispose: () => context.plugins.forEach(plugin => plugin[1].dispose?.()),
|
|
202
215
|
context,
|
|
203
216
|
};
|
|
204
|
-
for (const
|
|
205
|
-
context.
|
|
217
|
+
for (const plugin of plugins) {
|
|
218
|
+
context.plugins.push([plugin, plugin.create(context, api)]);
|
|
206
219
|
}
|
|
207
220
|
return api;
|
|
208
221
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -4,13 +4,11 @@ import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
|
4
4
|
import type * as ts from 'typescript';
|
|
5
5
|
import type { LinkedCodeMapWithDocument, SourceMapWithDocuments } from './documents';
|
|
6
6
|
import type { LanguageService } from './languageService';
|
|
7
|
+
import type { URI } from 'vscode-uri';
|
|
8
|
+
import type { UriMap } from './utils/uriMap';
|
|
7
9
|
export type * from 'vscode-languageserver-protocol';
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
typescript?: {
|
|
11
|
-
uriToFileName(uri: string): string;
|
|
12
|
-
fileNameToUri(fileName: string): string;
|
|
13
|
-
};
|
|
10
|
+
export interface LanguageServiceEnvironment {
|
|
11
|
+
workspaceFolders: URI[];
|
|
14
12
|
locale?: string;
|
|
15
13
|
clientCapabilities?: vscode.ClientCapabilities;
|
|
16
14
|
fs?: FileSystem;
|
|
@@ -20,9 +18,9 @@ export interface ServiceEnvironment {
|
|
|
20
18
|
onDidChangeWatchedFiles?(cb: (params: vscode.DidChangeWatchedFilesParams) => void): vscode.Disposable;
|
|
21
19
|
}
|
|
22
20
|
export interface FileSystem {
|
|
23
|
-
stat(uri:
|
|
24
|
-
readDirectory(uri:
|
|
25
|
-
readFile(uri:
|
|
21
|
+
stat(uri: URI): ProviderResult<FileStat | undefined>;
|
|
22
|
+
readDirectory(uri: URI): ProviderResult<[string, FileType][]>;
|
|
23
|
+
readFile(uri: URI, encoding?: string): ProviderResult<string | undefined>;
|
|
26
24
|
}
|
|
27
25
|
export interface FileStat {
|
|
28
26
|
type: FileType;
|
|
@@ -36,32 +34,32 @@ export declare enum FileType {
|
|
|
36
34
|
Directory = 2,
|
|
37
35
|
SymbolicLink = 64
|
|
38
36
|
}
|
|
39
|
-
export interface
|
|
37
|
+
export interface LanguageServiceCommand<T extends any[]> {
|
|
40
38
|
create(...args: T): vscode.Command | undefined;
|
|
41
39
|
is(value: vscode.Command): boolean;
|
|
42
40
|
}
|
|
43
|
-
export interface
|
|
44
|
-
language: Language
|
|
45
|
-
env:
|
|
41
|
+
export interface LanguageServiceContext {
|
|
42
|
+
language: Language<URI>;
|
|
43
|
+
env: LanguageServiceEnvironment;
|
|
46
44
|
inject<Provide, K extends keyof Provide = keyof Provide>(key: K, ...args: Provide[K] extends (...args: any) => any ? Parameters<Provide[K]> : never): ReturnType<Provide[K] extends (...args: any) => any ? Provide[K] : never> | undefined;
|
|
47
45
|
commands: {
|
|
48
|
-
showReferences:
|
|
49
|
-
rename:
|
|
50
|
-
setSelection:
|
|
46
|
+
showReferences: LanguageServiceCommand<[uri: string, position: vscode.Position, locations: vscode.Location[]]>;
|
|
47
|
+
rename: LanguageServiceCommand<[uri: string, position: vscode.Position]>;
|
|
48
|
+
setSelection: LanguageServiceCommand<[position: vscode.Position]>;
|
|
51
49
|
};
|
|
52
50
|
documents: {
|
|
53
|
-
get(uri:
|
|
51
|
+
get(uri: URI, languageId: string, snapshot: ts.IScriptSnapshot): TextDocument;
|
|
54
52
|
getMaps(virtualCode: VirtualCode): Generator<SourceMapWithDocuments>;
|
|
55
|
-
getLinkedCodeMap(virtualCode: VirtualCode,
|
|
53
|
+
getLinkedCodeMap(virtualCode: VirtualCode, documentUri: URI): LinkedCodeMapWithDocument | undefined;
|
|
56
54
|
};
|
|
57
|
-
|
|
58
|
-
disabledEmbeddedDocumentUris:
|
|
55
|
+
plugins: [LanguageServicePlugin, LanguageServicePluginInstance][];
|
|
56
|
+
disabledEmbeddedDocumentUris: UriMap<boolean>;
|
|
59
57
|
disabledServicePlugins: WeakSet<LanguageServicePluginInstance>;
|
|
60
|
-
decodeEmbeddedDocumentUri(maybeEmbeddedUri:
|
|
61
|
-
documentUri:
|
|
58
|
+
decodeEmbeddedDocumentUri(maybeEmbeddedUri: URI): [
|
|
59
|
+
documentUri: URI,
|
|
62
60
|
embeddedCodeId: string
|
|
63
61
|
] | undefined;
|
|
64
|
-
encodeEmbeddedDocumentUri(uri:
|
|
62
|
+
encodeEmbeddedDocumentUri(uri: URI, embeededCodeId: string): URI;
|
|
65
63
|
}
|
|
66
64
|
export type ProviderResult<T> = T | Thenable<T>;
|
|
67
65
|
export type NullableProviderResult<T> = ProviderResult<T | undefined | null>;
|
|
@@ -74,15 +72,58 @@ export type SemanticToken = [
|
|
|
74
72
|
];
|
|
75
73
|
export interface LanguageServicePlugin<P = any> {
|
|
76
74
|
name?: string;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
capabilities: {
|
|
76
|
+
selectionRangeProvider?: boolean;
|
|
77
|
+
foldingRangeProvider?: boolean;
|
|
78
|
+
linkedEditingRangeProvider?: boolean;
|
|
79
|
+
colorProvider?: boolean;
|
|
80
|
+
documentSymbolProvider?: boolean;
|
|
81
|
+
documentFormattingProvider?: boolean;
|
|
82
|
+
referencesProvider?: boolean;
|
|
83
|
+
implementationProvider?: boolean;
|
|
84
|
+
definitionProvider?: boolean;
|
|
85
|
+
typeDefinitionProvider?: boolean;
|
|
86
|
+
callHierarchyProvider?: boolean;
|
|
87
|
+
hoverProvider?: boolean;
|
|
88
|
+
documentHighlightProvider?: boolean;
|
|
89
|
+
workspaceSymbolProvider?: boolean;
|
|
90
|
+
renameProvider?: {
|
|
91
|
+
prepareProvider?: boolean;
|
|
92
|
+
};
|
|
93
|
+
signatureHelpProvider?: {
|
|
94
|
+
triggerCharacters?: string[];
|
|
95
|
+
retriggerCharacters?: string[];
|
|
96
|
+
};
|
|
97
|
+
completionProvider?: {
|
|
98
|
+
resolveProvider?: boolean;
|
|
99
|
+
triggerCharacters?: string[];
|
|
100
|
+
};
|
|
101
|
+
autoInsertionProvider?: {
|
|
102
|
+
triggerCharacters: string[];
|
|
103
|
+
configurationSections?: string[];
|
|
104
|
+
};
|
|
105
|
+
documentOnTypeFormattingProvider?: {
|
|
106
|
+
triggerCharacters: string[];
|
|
107
|
+
};
|
|
108
|
+
documentLinkProvider?: {
|
|
109
|
+
resolveProvider?: boolean;
|
|
110
|
+
};
|
|
111
|
+
codeLensProvider?: {
|
|
112
|
+
resolveProvider?: boolean;
|
|
113
|
+
};
|
|
114
|
+
inlayHintProvider?: {
|
|
115
|
+
resolveProvider?: boolean;
|
|
116
|
+
};
|
|
117
|
+
semanticTokensProvider?: {
|
|
118
|
+
legend: vscode.SemanticTokensLegend;
|
|
119
|
+
};
|
|
120
|
+
codeActionProvider?: {
|
|
121
|
+
codeActionKinds?: string[];
|
|
122
|
+
resolveProvider?: boolean;
|
|
123
|
+
};
|
|
124
|
+
diagnosticProvider?: boolean;
|
|
125
|
+
};
|
|
126
|
+
create(context: LanguageServiceContext, languageService: LanguageService): LanguageServicePluginInstance<P>;
|
|
86
127
|
}
|
|
87
128
|
export interface EmbeddedCodeFormattingOptions {
|
|
88
129
|
level: number;
|
|
@@ -127,19 +168,19 @@ export interface LanguageServicePluginInstance<P = any> {
|
|
|
127
168
|
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Diagnostic[]>;
|
|
128
169
|
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Location[]>;
|
|
129
170
|
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Range[]>;
|
|
130
|
-
|
|
171
|
+
provideAutoInsertSnippet?(document: TextDocument, position: vscode.Position, lastChange: {
|
|
131
172
|
rangeOffset: number;
|
|
132
173
|
rangeLength: number;
|
|
133
174
|
text: string;
|
|
134
|
-
}, token: vscode.CancellationToken): NullableProviderResult<string
|
|
135
|
-
provideFileRenameEdits?(oldUri:
|
|
175
|
+
}, token: vscode.CancellationToken): NullableProviderResult<string>;
|
|
176
|
+
provideFileRenameEdits?(oldUri: URI, newUri: URI, token: vscode.CancellationToken): NullableProviderResult<vscode.WorkspaceEdit>;
|
|
136
177
|
provideDocumentDropEdits?(document: TextDocument, position: vscode.Position, dataTransfer: Map<string, DataTransferItem>, token: vscode.CancellationToken): NullableProviderResult<DocumentDropEdit>;
|
|
137
178
|
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): ProviderResult<vscode.CodeLens>;
|
|
138
179
|
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): ProviderResult<vscode.CodeAction>;
|
|
139
180
|
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): ProviderResult<vscode.CompletionItem>;
|
|
140
181
|
resolveDocumentLink?(link: vscode.DocumentLink, token: vscode.CancellationToken): ProviderResult<vscode.DocumentLink>;
|
|
141
182
|
resolveInlayHint?(inlayHint: vscode.InlayHint, token: vscode.CancellationToken): ProviderResult<vscode.InlayHint>;
|
|
142
|
-
resolveEmbeddedCodeFormattingOptions?(sourceScript: SourceScript
|
|
183
|
+
resolveEmbeddedCodeFormattingOptions?(sourceScript: SourceScript<URI>, embeddedCode: VirtualCode, options: EmbeddedCodeFormattingOptions, token: vscode.CancellationToken): NullableProviderResult<EmbeddedCodeFormattingOptions>;
|
|
143
184
|
transformCompletionItem?(item: vscode.CompletionItem): vscode.CompletionItem | undefined;
|
|
144
185
|
transformCodeAction?(item: vscode.CodeAction): vscode.CodeAction | undefined;
|
|
145
186
|
dispose?(): void;
|
package/lib/utils/common.js
CHANGED
|
@@ -23,18 +23,12 @@ function findOverlapCodeRange(start, end, map, filter) {
|
|
|
23
23
|
const mappingEnd = mapping.sourceOffsets[mapping.sourceOffsets.length - 1] + mapping.lengths[mapping.lengths.length - 1];
|
|
24
24
|
const overlap = getOverlapRange(start, end, mappingStart, mappingEnd);
|
|
25
25
|
if (overlap) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (mappedEnd === undefined) {
|
|
33
|
-
mappedEnd = overlap.end + mapping.generatedOffsets[0] - mappingStart;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
mappedEnd = Math.max(mappedEnd, overlap.end + mapping.generatedOffsets[0] - mappingStart);
|
|
37
|
-
}
|
|
26
|
+
const curMappedStart = (overlap.start - mappingStart) + mapping.generatedOffsets[0];
|
|
27
|
+
mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);
|
|
28
|
+
const lastGeneratedLength = (mapping.generatedLengths ?? mapping.lengths)[mapping.generatedOffsets.length - 1];
|
|
29
|
+
const curMappedEndOffset = Math.min(overlap.end - mapping.sourceOffsets[mapping.sourceOffsets.length - 1], lastGeneratedLength);
|
|
30
|
+
const curMappedEnd = mapping.generatedOffsets[mapping.generatedOffsets.length - 1] + curMappedEndOffset;
|
|
31
|
+
mappedEnd = mappedEnd === undefined ? curMappedEnd : Math.max(mappedEnd, curMappedEnd);
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
}
|
package/lib/utils/dedupe.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function createLocationSet(): {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function withCodeAction<T extends vscode.CodeAction>(items: T[]): T[];
|
|
7
7
|
export declare function withTextEdits<T extends vscode.TextEdit>(items: T[]): T[];
|
|
8
|
-
export declare function withDocumentChanges(items: NonNullable<vscode.WorkspaceEdit['documentChanges']>): (vscode.
|
|
8
|
+
export declare function withDocumentChanges(items: NonNullable<vscode.WorkspaceEdit['documentChanges']>): (vscode.TextDocumentEdit | vscode.CreateFile | vscode.RenameFile | vscode.DeleteFile)[];
|
|
9
9
|
export declare function withDiagnostics<T extends vscode.Diagnostic>(items: T[]): T[];
|
|
10
10
|
export declare function withLocations<T extends vscode.Location>(items: T[]): T[];
|
|
11
11
|
export declare function withLocationLinks<T extends vscode.LocationLink>(items: T[]): T[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualCode } from '@volar/language-core';
|
|
2
2
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
+
import type { URI } from 'vscode-uri';
|
|
3
4
|
import type { SourceMapWithDocuments } from '../documents';
|
|
4
|
-
import type {
|
|
5
|
-
export declare function documentFeatureWorker<T>(context:
|
|
6
|
-
export declare function languageFeatureWorker<T, K>(context:
|
|
5
|
+
import type { LanguageServicePlugin, LanguageServicePluginInstance, LanguageServiceContext } from '../types';
|
|
6
|
+
export declare function documentFeatureWorker<T>(context: LanguageServiceContext, uri: URI, valid: (map: SourceMapWithDocuments) => boolean, worker: (plugin: [LanguageServicePlugin, LanguageServicePluginInstance], document: TextDocument) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: SourceMapWithDocuments) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
7
|
+
export declare function languageFeatureWorker<T, K>(context: LanguageServiceContext, uri: URI, getRealDocParams: () => K, eachVirtualDocParams: (map: SourceMapWithDocuments) => Generator<K>, worker: (plugin: [LanguageServicePlugin, LanguageServicePluginInstance], document: TextDocument, params: K, map?: SourceMapWithDocuments) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: SourceMapWithDocuments) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
7
8
|
export declare function safeCall<T>(cb: () => Thenable<T> | T, errorMsg?: string): Promise<T | undefined>;
|
|
8
|
-
export declare function forEachEmbeddedDocument(context:
|
|
9
|
-
export declare function getEmbeddedFilesByLevel(context:
|
|
9
|
+
export declare function forEachEmbeddedDocument(context: LanguageServiceContext, sourceScriptId: URI, current: VirtualCode): Generator<SourceMapWithDocuments>;
|
|
10
|
+
export declare function getEmbeddedFilesByLevel(context: LanguageServiceContext, sourceFileUri: URI, rootFile: VirtualCode, level: number): VirtualCode[];
|