@volar/language-service 2.3.0-alpha.9 → 2.3.1
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 +4 -4
- package/lib/features/provideCallHierarchyItems.js +21 -20
- 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 +3 -0
- package/lib/features/provideDiagnostics.js +66 -59
- package/lib/features/provideDocumentColors.js +6 -8
- package/lib/features/provideDocumentDropEdits.js +3 -4
- package/lib/features/provideDocumentFormattingEdits.js +15 -14
- 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 +11 -8
- package/lib/features/provideSignatureHelp.js +2 -3
- package/lib/features/provideWorkspaceDiagnostics.d.ts +3 -0
- package/lib/features/provideWorkspaceDiagnostics.js +69 -0
- 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 +102 -35
- package/lib/languageService.js +63 -75
- package/lib/types.d.ts +6 -5
- 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 -6
- package/lib/utils/featureWorkers.js +106 -38
- 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
package/lib/languageService.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
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 {
|
|
5
|
-
export type LanguageService = ReturnType<typeof
|
|
4
|
+
import type { LanguageServiceContext, LanguageServiceEnvironment, LanguageServicePlugin } from './types';
|
|
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): {
|
|
8
|
+
dispose: () => void;
|
|
9
|
+
context: LanguageServiceContext;
|
|
10
|
+
getCallHierarchyItems(uri: URI, position: vscode.Position, token?: vscode.CancellationToken): Promise<vscode.CallHierarchyItem[] | undefined>;
|
|
11
|
+
getCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[]>;
|
|
12
|
+
getCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
7
13
|
getSemanticTokenLegend: () => {
|
|
8
14
|
tokenModifiers: string[];
|
|
9
15
|
tokenTypes: string[];
|
|
@@ -12,56 +18,117 @@ export declare function createLanguageService(language: Language<URI>, plugins:
|
|
|
12
18
|
getAutoFormatTriggerCharacters: () => string[];
|
|
13
19
|
getSignatureHelpTriggerCharacters: () => string[];
|
|
14
20
|
getSignatureHelpRetriggerCharacters: () => string[];
|
|
15
|
-
|
|
21
|
+
getDocumentFormattingEdits: (uri: URI, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
16
22
|
ch: string;
|
|
17
23
|
position: vscode.Position;
|
|
18
24
|
} | undefined, token?: vscode.CancellationToken) => Promise<vscode.TextEdit[] | undefined>;
|
|
19
25
|
getFoldingRanges: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.FoldingRange[] | undefined>;
|
|
20
26
|
getSelectionRanges: (uri: URI, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
getLinkedEditingRanges: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
28
|
+
getDocumentSymbols: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
29
|
+
getDocumentColors: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
24
30
|
getColorPresentations: (uri: URI, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (result: vscode.Diagnostic[]) => void) => Promise<vscode.Diagnostic[]>;
|
|
32
|
+
getWorkspaceDiagnostics: (token?: vscode.CancellationToken) => Promise<vscode.WorkspaceDocumentDiagnosticReport[]>;
|
|
33
|
+
getReferences: (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
34
|
+
getFileReferences: (uri: URI, token?: vscode.CancellationToken) => import("./types").NullableProviderResult<vscode.Location[]>;
|
|
35
|
+
getDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
36
|
+
getTypeDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
37
|
+
getImplementations: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
38
|
+
getRenameRange: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Range | {
|
|
32
39
|
range: vscode.Range;
|
|
33
40
|
placeholder: string;
|
|
34
41
|
} | {
|
|
35
42
|
message: string;
|
|
36
43
|
} | undefined>;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
doCodeActionResolve: (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
44
|
-
doCompletionResolve: (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
44
|
+
getRenameEdits: (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
45
|
+
getFileRenameEdits: (oldUri: URI, newUri: URI, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
46
|
+
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (tokens: vscode.SemanticTokens) => void) => Promise<vscode.SemanticTokens | undefined>;
|
|
47
|
+
getHover: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
48
|
+
getCompletionItems: (uri: URI, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
49
|
+
getCodeActions: (uri: URI, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
45
50
|
getSignatureHelp: (uri: URI, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
findWorkspaceSymbols: (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
52
|
-
doAutoInsert: (uri: URI, selection: vscode.Position, change: {
|
|
51
|
+
getCodeLenses: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
|
|
52
|
+
getDocumentHighlights: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
53
|
+
getDocumentLinks: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
|
|
54
|
+
getWorkspaceSymbols: (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
55
|
+
getAutoInsertSnippet: (uri: URI, selection: vscode.Position, change: {
|
|
53
56
|
rangeOffset: number;
|
|
54
57
|
rangeLength: number;
|
|
55
58
|
text: string;
|
|
56
59
|
}, token?: vscode.CancellationToken) => Promise<string | undefined>;
|
|
57
|
-
|
|
60
|
+
getDocumentDropEdits: (uri: URI, position: vscode.Position, dataTransfer: Map<string, import("./types").DataTransferItem>, token?: vscode.CancellationToken) => Promise<import("./types").DocumentDropEdit | undefined>;
|
|
58
61
|
getInlayHints: (uri: URI, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
resolveCodeAction: (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
63
|
+
resolveCompletionItem: (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
64
|
+
resolveCodeLens: (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
65
|
+
resolveDocumentLink: (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
66
|
+
resolveInlayHint: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
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;
|
|
73
|
+
declare function createLanguageServiceBase(plugins: LanguageServicePlugin[], context: LanguageServiceContext): {
|
|
65
74
|
dispose: () => void;
|
|
66
75
|
context: LanguageServiceContext;
|
|
76
|
+
getCallHierarchyItems(uri: URI, position: vscode.Position, token?: vscode.CancellationToken): Promise<vscode.CallHierarchyItem[] | undefined>;
|
|
77
|
+
getCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[]>;
|
|
78
|
+
getCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
79
|
+
getSemanticTokenLegend: () => {
|
|
80
|
+
tokenModifiers: string[];
|
|
81
|
+
tokenTypes: string[];
|
|
82
|
+
};
|
|
83
|
+
getTriggerCharacters: () => string[];
|
|
84
|
+
getAutoFormatTriggerCharacters: () => string[];
|
|
85
|
+
getSignatureHelpTriggerCharacters: () => string[];
|
|
86
|
+
getSignatureHelpRetriggerCharacters: () => string[];
|
|
87
|
+
getDocumentFormattingEdits: (uri: URI, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
88
|
+
ch: string;
|
|
89
|
+
position: vscode.Position;
|
|
90
|
+
} | undefined, token?: vscode.CancellationToken) => Promise<vscode.TextEdit[] | undefined>;
|
|
91
|
+
getFoldingRanges: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.FoldingRange[] | undefined>;
|
|
92
|
+
getSelectionRanges: (uri: URI, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
93
|
+
getLinkedEditingRanges: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
94
|
+
getDocumentSymbols: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
95
|
+
getDocumentColors: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
96
|
+
getColorPresentations: (uri: URI, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
97
|
+
getDiagnostics: (uri: URI, token?: vscode.CancellationToken, response?: (result: vscode.Diagnostic[]) => void) => Promise<vscode.Diagnostic[]>;
|
|
98
|
+
getWorkspaceDiagnostics: (token?: vscode.CancellationToken) => Promise<vscode.WorkspaceDocumentDiagnosticReport[]>;
|
|
99
|
+
getReferences: (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
100
|
+
getFileReferences: (uri: URI, token?: vscode.CancellationToken) => import("./types").NullableProviderResult<vscode.Location[]>;
|
|
101
|
+
getDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
102
|
+
getTypeDefinition: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
103
|
+
getImplementations: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
104
|
+
getRenameRange: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Range | {
|
|
105
|
+
range: vscode.Range;
|
|
106
|
+
placeholder: string;
|
|
107
|
+
} | {
|
|
108
|
+
message: string;
|
|
109
|
+
} | undefined>;
|
|
110
|
+
getRenameEdits: (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
111
|
+
getFileRenameEdits: (oldUri: URI, newUri: URI, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
112
|
+
getSemanticTokens: (uri: URI, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: (tokens: vscode.SemanticTokens) => void) => Promise<vscode.SemanticTokens | undefined>;
|
|
113
|
+
getHover: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
114
|
+
getCompletionItems: (uri: URI, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
115
|
+
getCodeActions: (uri: URI, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
116
|
+
getSignatureHelp: (uri: URI, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
117
|
+
getCodeLenses: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
|
|
118
|
+
getDocumentHighlights: (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
119
|
+
getDocumentLinks: (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
|
|
120
|
+
getWorkspaceSymbols: (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
121
|
+
getAutoInsertSnippet: (uri: URI, selection: vscode.Position, change: {
|
|
122
|
+
rangeOffset: number;
|
|
123
|
+
rangeLength: number;
|
|
124
|
+
text: string;
|
|
125
|
+
}, token?: vscode.CancellationToken) => Promise<string | undefined>;
|
|
126
|
+
getDocumentDropEdits: (uri: URI, position: vscode.Position, dataTransfer: Map<string, import("./types").DataTransferItem>, token?: vscode.CancellationToken) => Promise<import("./types").DocumentDropEdit | undefined>;
|
|
127
|
+
getInlayHints: (uri: URI, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
128
|
+
resolveCodeAction: (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
129
|
+
resolveCompletionItem: (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
130
|
+
resolveCodeLens: (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
131
|
+
resolveDocumentLink: (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
132
|
+
resolveInlayHint: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
67
133
|
};
|
|
134
|
+
export {};
|
package/lib/languageService.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.embeddedContentScheme = void 0;
|
|
4
|
+
exports.createLanguageService = createLanguageService;
|
|
5
|
+
exports.decodeEmbeddedDocumentUri = decodeEmbeddedDocumentUri;
|
|
6
|
+
exports.encodeEmbeddedDocumentUri = encodeEmbeddedDocumentUri;
|
|
4
7
|
const language_core_1 = require("@volar/language-core");
|
|
5
8
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
9
|
const vscode_uri_1 = require("vscode-uri");
|
|
7
|
-
const documents_1 = require("./documents");
|
|
8
10
|
const autoInsert = require("./features/provideAutoInsertSnippet");
|
|
9
11
|
const callHierarchy = require("./features/provideCallHierarchyItems");
|
|
10
12
|
const codeActions = require("./features/provideCodeActions");
|
|
@@ -31,6 +33,7 @@ const rename = require("./features/provideRenameEdits");
|
|
|
31
33
|
const renamePrepare = require("./features/provideRenameRange");
|
|
32
34
|
const selectionRanges = require("./features/provideSelectionRanges");
|
|
33
35
|
const signatureHelp = require("./features/provideSignatureHelp");
|
|
36
|
+
const workspaceDiagnostics = require("./features/provideWorkspaceDiagnostics");
|
|
34
37
|
const workspaceSymbol = require("./features/provideWorkspaceSymbols");
|
|
35
38
|
const codeActionResolve = require("./features/resolveCodeAction");
|
|
36
39
|
const codeLensResolve = require("./features/resolveCodeLens");
|
|
@@ -38,14 +41,13 @@ const completionResolve = require("./features/resolveCompletionItem");
|
|
|
38
41
|
const documentLinkResolve = require("./features/resolveDocumentLink");
|
|
39
42
|
const inlayHintResolve = require("./features/resolveInlayHint");
|
|
40
43
|
const uriMap_1 = require("./utils/uriMap");
|
|
44
|
+
exports.embeddedContentScheme = 'volar-embedded-content';
|
|
41
45
|
function createLanguageService(language, plugins, env) {
|
|
42
46
|
const documentVersions = (0, uriMap_1.createUriMap)();
|
|
43
|
-
const map2DocMap = new WeakMap();
|
|
44
|
-
const mirrorMap2DocMirrorMap = new WeakMap();
|
|
45
47
|
const snapshot2Doc = new WeakMap();
|
|
46
|
-
const embeddedContentScheme = 'volar-embedded-content';
|
|
47
48
|
const context = {
|
|
48
49
|
language,
|
|
50
|
+
getLanguageService: () => langaugeService,
|
|
49
51
|
documents: {
|
|
50
52
|
get(uri, languageId, snapshot) {
|
|
51
53
|
if (!snapshot2Doc.has(snapshot)) {
|
|
@@ -59,25 +61,6 @@ function createLanguageService(language, plugins, env) {
|
|
|
59
61
|
}
|
|
60
62
|
return map.get(uri);
|
|
61
63
|
},
|
|
62
|
-
*getMaps(virtualCode) {
|
|
63
|
-
for (const [uri, snapshot, map] of context.language.maps.forEach(virtualCode)) {
|
|
64
|
-
if (!map2DocMap.has(map)) {
|
|
65
|
-
const embeddedUri = context.encodeEmbeddedDocumentUri(uri, virtualCode.id);
|
|
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));
|
|
67
|
-
}
|
|
68
|
-
yield map2DocMap.get(map);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
getLinkedCodeMap(virtualCode, documentUri) {
|
|
72
|
-
const map = context.language.linkedCodeMaps.get(virtualCode);
|
|
73
|
-
if (map) {
|
|
74
|
-
if (!mirrorMap2DocMirrorMap.has(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));
|
|
77
|
-
}
|
|
78
|
-
return mirrorMap2DocMirrorMap.get(map);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
64
|
},
|
|
82
65
|
env,
|
|
83
66
|
inject: (key, ...args) => {
|
|
@@ -146,25 +129,34 @@ function createLanguageService(language, plugins, env) {
|
|
|
146
129
|
},
|
|
147
130
|
disabledEmbeddedDocumentUris: (0, uriMap_1.createUriMap)(),
|
|
148
131
|
disabledServicePlugins: new WeakSet(),
|
|
149
|
-
decodeEmbeddedDocumentUri
|
|
150
|
-
|
|
151
|
-
const embeddedCodeId = decodeURIComponent(maybeEmbeddedContentUri.authority);
|
|
152
|
-
const documentUri = decodeURIComponent(maybeEmbeddedContentUri.path.substring(1));
|
|
153
|
-
return [
|
|
154
|
-
vscode_uri_1.URI.parse(documentUri),
|
|
155
|
-
embeddedCodeId,
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
encodeEmbeddedDocumentUri(documentUri, embeddedContentId) {
|
|
160
|
-
return vscode_uri_1.URI.from({
|
|
161
|
-
scheme: embeddedContentScheme,
|
|
162
|
-
authority: encodeURIComponent(embeddedContentId),
|
|
163
|
-
path: '/' + encodeURIComponent(documentUri.toString()),
|
|
164
|
-
});
|
|
165
|
-
},
|
|
132
|
+
decodeEmbeddedDocumentUri,
|
|
133
|
+
encodeEmbeddedDocumentUri,
|
|
166
134
|
};
|
|
167
|
-
const
|
|
135
|
+
for (const plugin of plugins) {
|
|
136
|
+
context.plugins.push([plugin, plugin.create(context)]);
|
|
137
|
+
}
|
|
138
|
+
const langaugeService = createLanguageServiceBase(plugins, context);
|
|
139
|
+
return langaugeService;
|
|
140
|
+
}
|
|
141
|
+
function decodeEmbeddedDocumentUri(maybeEmbeddedContentUri) {
|
|
142
|
+
if (maybeEmbeddedContentUri.scheme === exports.embeddedContentScheme) {
|
|
143
|
+
const embeddedCodeId = decodeURIComponent(maybeEmbeddedContentUri.authority);
|
|
144
|
+
const documentUri = decodeURIComponent(maybeEmbeddedContentUri.path.substring(1));
|
|
145
|
+
return [
|
|
146
|
+
vscode_uri_1.URI.parse(documentUri),
|
|
147
|
+
embeddedCodeId,
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function encodeEmbeddedDocumentUri(documentUri, embeddedContentId) {
|
|
152
|
+
return vscode_uri_1.URI.from({
|
|
153
|
+
scheme: exports.embeddedContentScheme,
|
|
154
|
+
authority: encodeURIComponent(embeddedContentId),
|
|
155
|
+
path: '/' + encodeURIComponent(documentUri.toString()),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function createLanguageServiceBase(plugins, context) {
|
|
159
|
+
return {
|
|
168
160
|
getSemanticTokenLegend: () => {
|
|
169
161
|
const tokenModifiers = plugins.map(plugin => plugin.capabilities.semanticTokensProvider?.legend?.tokenModifiers ?? []).flat();
|
|
170
162
|
const tokenTypes = plugins.map(plugin => plugin.capabilities.semanticTokensProvider?.legend?.tokenTypes ?? []).flat();
|
|
@@ -177,47 +169,43 @@ function createLanguageService(language, plugins, env) {
|
|
|
177
169
|
getAutoFormatTriggerCharacters: () => plugins.map(plugin => plugin.capabilities.documentOnTypeFormattingProvider?.triggerCharacters ?? []).flat(),
|
|
178
170
|
getSignatureHelpTriggerCharacters: () => plugins.map(plugin => plugin.capabilities.signatureHelpProvider?.triggerCharacters ?? []).flat(),
|
|
179
171
|
getSignatureHelpRetriggerCharacters: () => plugins.map(plugin => plugin.capabilities.signatureHelpProvider?.retriggerCharacters ?? []).flat(),
|
|
180
|
-
|
|
172
|
+
getDocumentFormattingEdits: format.register(context),
|
|
181
173
|
getFoldingRanges: foldingRanges.register(context),
|
|
182
174
|
getSelectionRanges: selectionRanges.register(context),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
getLinkedEditingRanges: linkedEditing.register(context),
|
|
176
|
+
getDocumentSymbols: documentSymbols.register(context),
|
|
177
|
+
getDocumentColors: documentColors.register(context),
|
|
186
178
|
getColorPresentations: colorPresentations.register(context),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
179
|
+
getDiagnostics: diagnostics.register(context),
|
|
180
|
+
getWorkspaceDiagnostics: workspaceDiagnostics.register(context),
|
|
181
|
+
getReferences: references.register(context),
|
|
182
|
+
getFileReferences: fileReferences.register(context),
|
|
183
|
+
getDefinition: definition.register(context, 'provideDefinition', language_core_1.isDefinitionEnabled),
|
|
184
|
+
getTypeDefinition: definition.register(context, 'provideTypeDefinition', language_core_1.isTypeDefinitionEnabled),
|
|
185
|
+
getImplementations: definition.register(context, 'provideImplementation', language_core_1.isImplementationEnabled),
|
|
186
|
+
getRenameRange: renamePrepare.register(context),
|
|
187
|
+
getRenameEdits: rename.register(context),
|
|
188
|
+
getFileRenameEdits: fileRename.register(context),
|
|
196
189
|
getSemanticTokens: semanticTokens.register(context),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
doCodeActionResolve: codeActionResolve.register(context),
|
|
201
|
-
doCompletionResolve: completionResolve.register(context),
|
|
190
|
+
getHover: hover.register(context),
|
|
191
|
+
getCompletionItems: completions.register(context),
|
|
192
|
+
getCodeActions: codeActions.register(context),
|
|
202
193
|
getSignatureHelp: signatureHelp.register(context),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
doAutoInsert: autoInsert.register(context),
|
|
210
|
-
doDocumentDrop: documentDrop.register(context),
|
|
194
|
+
getCodeLenses: codeLens.register(context),
|
|
195
|
+
getDocumentHighlights: documentHighlight.register(context),
|
|
196
|
+
getDocumentLinks: documentLink.register(context),
|
|
197
|
+
getWorkspaceSymbols: workspaceSymbol.register(context),
|
|
198
|
+
getAutoInsertSnippet: autoInsert.register(context),
|
|
199
|
+
getDocumentDropEdits: documentDrop.register(context),
|
|
211
200
|
getInlayHints: inlayHints.register(context),
|
|
212
|
-
|
|
213
|
-
|
|
201
|
+
resolveCodeAction: codeActionResolve.register(context),
|
|
202
|
+
resolveCompletionItem: completionResolve.register(context),
|
|
203
|
+
resolveCodeLens: codeLensResolve.register(context),
|
|
204
|
+
resolveDocumentLink: documentLinkResolve.register(context),
|
|
205
|
+
resolveInlayHint: inlayHintResolve.register(context),
|
|
206
|
+
...callHierarchy.register(context),
|
|
214
207
|
dispose: () => context.plugins.forEach(plugin => plugin[1].dispose?.()),
|
|
215
208
|
context,
|
|
216
209
|
};
|
|
217
|
-
for (const plugin of plugins) {
|
|
218
|
-
context.plugins.push([plugin, plugin.create(context, api)]);
|
|
219
|
-
}
|
|
220
|
-
return api;
|
|
221
210
|
}
|
|
222
|
-
exports.createLanguageService = createLanguageService;
|
|
223
211
|
//# sourceMappingURL=languageService.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { Language, SourceScript, VirtualCode } from '@volar/language-core';
|
|
|
2
2
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
import type * as ts from 'typescript';
|
|
5
|
-
import type { LinkedCodeMapWithDocument, SourceMapWithDocuments } from './documents';
|
|
6
5
|
import type { LanguageService } from './languageService';
|
|
7
6
|
import type { URI } from 'vscode-uri';
|
|
8
7
|
import type { UriMap } from './utils/uriMap';
|
|
@@ -40,6 +39,7 @@ export interface LanguageServiceCommand<T extends any[]> {
|
|
|
40
39
|
}
|
|
41
40
|
export interface LanguageServiceContext {
|
|
42
41
|
language: Language<URI>;
|
|
42
|
+
getLanguageService(): LanguageService;
|
|
43
43
|
env: LanguageServiceEnvironment;
|
|
44
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;
|
|
45
45
|
commands: {
|
|
@@ -49,8 +49,6 @@ export interface LanguageServiceContext {
|
|
|
49
49
|
};
|
|
50
50
|
documents: {
|
|
51
51
|
get(uri: URI, languageId: string, snapshot: ts.IScriptSnapshot): TextDocument;
|
|
52
|
-
getMaps(virtualCode: VirtualCode): Generator<SourceMapWithDocuments>;
|
|
53
|
-
getLinkedCodeMap(virtualCode: VirtualCode, documentUri: URI): LinkedCodeMapWithDocument | undefined;
|
|
54
52
|
};
|
|
55
53
|
plugins: [LanguageServicePlugin, LanguageServicePluginInstance][];
|
|
56
54
|
disabledEmbeddedDocumentUris: UriMap<boolean>;
|
|
@@ -121,9 +119,11 @@ export interface LanguageServicePlugin<P = any> {
|
|
|
121
119
|
codeActionKinds?: string[];
|
|
122
120
|
resolveProvider?: boolean;
|
|
123
121
|
};
|
|
124
|
-
diagnosticProvider?:
|
|
122
|
+
diagnosticProvider?: {
|
|
123
|
+
workspaceDiagnostics?: boolean;
|
|
124
|
+
};
|
|
125
125
|
};
|
|
126
|
-
create(context: LanguageServiceContext
|
|
126
|
+
create(context: LanguageServiceContext): LanguageServicePluginInstance<P>;
|
|
127
127
|
}
|
|
128
128
|
export interface EmbeddedCodeFormattingOptions {
|
|
129
129
|
level: number;
|
|
@@ -166,6 +166,7 @@ export interface LanguageServicePluginInstance<P = any> {
|
|
|
166
166
|
provideWorkspaceSymbols?(query: string, token: vscode.CancellationToken): NullableProviderResult<vscode.WorkspaceSymbol[]>;
|
|
167
167
|
provideDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Diagnostic[]>;
|
|
168
168
|
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Diagnostic[]>;
|
|
169
|
+
provideWorkspaceDiagnostics?(token: vscode.CancellationToken): NullableProviderResult<vscode.WorkspaceDocumentDiagnosticReport[]>;
|
|
169
170
|
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Location[]>;
|
|
170
171
|
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableProviderResult<vscode.Range[]>;
|
|
171
172
|
provideAutoInsertSnippet?(document: TextDocument, position: vscode.Position, lastChange: {
|
package/lib/utils/common.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { CodeInformation, Mapper } from '@volar/language-core';
|
|
1
2
|
import type * as ts from 'typescript';
|
|
2
3
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
|
|
4
|
-
export declare function findOverlapCodeRange(start: number, end: number, map: SourceMap<CodeInformation>, filter: (data: CodeInformation) => boolean): {
|
|
4
|
+
export declare function findOverlapCodeRange(start: number, end: number, map: Mapper, filter: (data: CodeInformation) => boolean): {
|
|
5
5
|
start: number;
|
|
6
6
|
end: number;
|
|
7
7
|
} | undefined;
|
|
@@ -9,4 +9,3 @@ export declare function isInsideRange(parent: vscode.Range, child: vscode.Range)
|
|
|
9
9
|
export declare function isEqualRange(a: vscode.Range, b: vscode.Range): boolean;
|
|
10
10
|
export declare function stringToSnapshot(str: string): ts.IScriptSnapshot;
|
|
11
11
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
12
|
-
export declare function notEmpty<T>(value: T | null | undefined): value is T;
|
package/lib/utils/common.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.findOverlapCodeRange = findOverlapCodeRange;
|
|
4
|
+
exports.isInsideRange = isInsideRange;
|
|
5
|
+
exports.isEqualRange = isEqualRange;
|
|
6
|
+
exports.stringToSnapshot = stringToSnapshot;
|
|
7
|
+
exports.sleep = sleep;
|
|
4
8
|
function findOverlapCodeRange(start, end, map, filter) {
|
|
5
9
|
let mappedStart;
|
|
6
10
|
let mappedEnd;
|
|
7
|
-
for (const [mapped, mapping] of map.
|
|
11
|
+
for (const [mapped, mapping] of map.toGeneratedLocation(start)) {
|
|
8
12
|
if (filter(mapping.data)) {
|
|
9
13
|
mappedStart = mapped;
|
|
10
14
|
break;
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
|
-
for (const [mapped, mapping] of map.
|
|
17
|
+
for (const [mapped, mapping] of map.toGeneratedLocation(end)) {
|
|
14
18
|
if (filter(mapping.data)) {
|
|
15
19
|
mappedEnd = mapped;
|
|
16
20
|
break;
|
|
@@ -40,7 +44,6 @@ function findOverlapCodeRange(start, end, map, filter) {
|
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
exports.findOverlapCodeRange = findOverlapCodeRange;
|
|
44
47
|
function getOverlapRange(range1Start, range1End, range2Start, range2End) {
|
|
45
48
|
const start = Math.max(range1Start, range2Start);
|
|
46
49
|
const end = Math.min(range1End, range2End);
|
|
@@ -67,14 +70,12 @@ function isInsideRange(parent, child) {
|
|
|
67
70
|
}
|
|
68
71
|
return true;
|
|
69
72
|
}
|
|
70
|
-
exports.isInsideRange = isInsideRange;
|
|
71
73
|
function isEqualRange(a, b) {
|
|
72
74
|
return a.start.line === b.start.line
|
|
73
75
|
&& a.start.character === b.start.character
|
|
74
76
|
&& a.end.line === b.end.line
|
|
75
77
|
&& a.end.character === b.end.character;
|
|
76
78
|
}
|
|
77
|
-
exports.isEqualRange = isEqualRange;
|
|
78
79
|
function stringToSnapshot(str) {
|
|
79
80
|
return {
|
|
80
81
|
getText: (start, end) => str.substring(start, end),
|
|
@@ -82,13 +83,7 @@ function stringToSnapshot(str) {
|
|
|
82
83
|
getChangeRange: () => undefined,
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
|
-
exports.stringToSnapshot = stringToSnapshot;
|
|
86
86
|
function sleep(ms) {
|
|
87
87
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
88
88
|
}
|
|
89
|
-
exports.sleep = sleep;
|
|
90
|
-
function notEmpty(value) {
|
|
91
|
-
return value !== null && value !== undefined;
|
|
92
|
-
}
|
|
93
|
-
exports.notEmpty = notEmpty;
|
|
94
89
|
//# sourceMappingURL=common.js.map
|
package/lib/utils/dedupe.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createLocationSet = createLocationSet;
|
|
4
|
+
exports.withCodeAction = withCodeAction;
|
|
5
|
+
exports.withTextEdits = withTextEdits;
|
|
6
|
+
exports.withDocumentChanges = withDocumentChanges;
|
|
7
|
+
exports.withDiagnostics = withDiagnostics;
|
|
8
|
+
exports.withLocations = withLocations;
|
|
9
|
+
exports.withLocationLinks = withLocationLinks;
|
|
10
|
+
exports.withCallHierarchyIncomingCalls = withCallHierarchyIncomingCalls;
|
|
11
|
+
exports.withCallHierarchyOutgoingCalls = withCallHierarchyOutgoingCalls;
|
|
12
|
+
exports.withRanges = withRanges;
|
|
4
13
|
function createLocationSet() {
|
|
5
14
|
const set = new Set();
|
|
6
15
|
return {
|
|
@@ -27,13 +36,11 @@ function createLocationSet() {
|
|
|
27
36
|
].join(':');
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
|
-
exports.createLocationSet = createLocationSet;
|
|
31
39
|
function withCodeAction(items) {
|
|
32
40
|
return dedupe(items, item => [
|
|
33
41
|
item.title
|
|
34
42
|
].join(':'));
|
|
35
43
|
}
|
|
36
|
-
exports.withCodeAction = withCodeAction;
|
|
37
44
|
function withTextEdits(items) {
|
|
38
45
|
return dedupe(items, item => [
|
|
39
46
|
item.range.start.line,
|
|
@@ -43,11 +50,9 @@ function withTextEdits(items) {
|
|
|
43
50
|
item.newText,
|
|
44
51
|
].join(':'));
|
|
45
52
|
}
|
|
46
|
-
exports.withTextEdits = withTextEdits;
|
|
47
53
|
function withDocumentChanges(items) {
|
|
48
54
|
return dedupe(items, item => JSON.stringify(item)); // TODO: improve this
|
|
49
55
|
}
|
|
50
|
-
exports.withDocumentChanges = withDocumentChanges;
|
|
51
56
|
function withDiagnostics(items) {
|
|
52
57
|
return dedupe(items, item => [
|
|
53
58
|
item.range.start.line,
|
|
@@ -60,7 +65,6 @@ function withDiagnostics(items) {
|
|
|
60
65
|
item.message,
|
|
61
66
|
].join(':'));
|
|
62
67
|
}
|
|
63
|
-
exports.withDiagnostics = withDiagnostics;
|
|
64
68
|
function withLocations(items) {
|
|
65
69
|
return dedupe(items, item => [
|
|
66
70
|
item.uri,
|
|
@@ -70,7 +74,6 @@ function withLocations(items) {
|
|
|
70
74
|
item.range.end.character,
|
|
71
75
|
].join(':'));
|
|
72
76
|
}
|
|
73
|
-
exports.withLocations = withLocations;
|
|
74
77
|
function withLocationLinks(items) {
|
|
75
78
|
return dedupe(items, item => [
|
|
76
79
|
item.targetUri,
|
|
@@ -81,7 +84,6 @@ function withLocationLinks(items) {
|
|
|
81
84
|
// ignore difference targetRange
|
|
82
85
|
].join(':'));
|
|
83
86
|
}
|
|
84
|
-
exports.withLocationLinks = withLocationLinks;
|
|
85
87
|
function withCallHierarchyIncomingCalls(items) {
|
|
86
88
|
return dedupe(items, item => [
|
|
87
89
|
item.from.uri,
|
|
@@ -91,7 +93,6 @@ function withCallHierarchyIncomingCalls(items) {
|
|
|
91
93
|
item.from.range.end.character,
|
|
92
94
|
].join(':'));
|
|
93
95
|
}
|
|
94
|
-
exports.withCallHierarchyIncomingCalls = withCallHierarchyIncomingCalls;
|
|
95
96
|
function withCallHierarchyOutgoingCalls(items) {
|
|
96
97
|
return dedupe(items, item => [
|
|
97
98
|
item.to.uri,
|
|
@@ -101,7 +102,6 @@ function withCallHierarchyOutgoingCalls(items) {
|
|
|
101
102
|
item.to.range.end.character,
|
|
102
103
|
].join(':'));
|
|
103
104
|
}
|
|
104
|
-
exports.withCallHierarchyOutgoingCalls = withCallHierarchyOutgoingCalls;
|
|
105
105
|
function withRanges(items) {
|
|
106
106
|
return dedupe(items, item => [
|
|
107
107
|
item.start.line,
|
|
@@ -110,7 +110,6 @@ function withRanges(items) {
|
|
|
110
110
|
item.end.character,
|
|
111
111
|
].join(':'));
|
|
112
112
|
}
|
|
113
|
-
exports.withRanges = withRanges;
|
|
114
113
|
function dedupe(items, getKey) {
|
|
115
114
|
const map = new Map();
|
|
116
115
|
for (const item of items.reverse()) {
|
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
import type { VirtualCode } from '@volar/language-core';
|
|
1
|
+
import type { CodeInformation, LinkedCodeMap, Mapper, SourceScript, VirtualCode } from '@volar/language-core';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
4
|
import type { URI } from 'vscode-uri';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import type { LanguageServiceContext, LanguageServicePlugin, LanguageServicePluginInstance } from '../types';
|
|
6
|
+
export type DocumentsAndMap = [
|
|
7
|
+
sourceDocument: TextDocument,
|
|
8
|
+
embeddedDocument: TextDocument,
|
|
9
|
+
map: Mapper
|
|
10
|
+
];
|
|
11
|
+
export declare function documentFeatureWorker<T>(context: LanguageServiceContext, uri: URI, valid: (info: DocumentsAndMap) => boolean, worker: (plugin: [LanguageServicePlugin, LanguageServicePluginInstance], document: TextDocument) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: DocumentsAndMap) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
12
|
+
export declare function languageFeatureWorker<T, K>(context: LanguageServiceContext, uri: URI, getRealDocParams: () => K, eachVirtualDocParams: (map: DocumentsAndMap) => Generator<K>, worker: (plugin: [LanguageServicePlugin, LanguageServicePluginInstance], document: TextDocument, params: K, map?: DocumentsAndMap) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: DocumentsAndMap) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
8
13
|
export declare function safeCall<T>(cb: () => Thenable<T> | T, errorMsg?: string): Promise<T | undefined>;
|
|
9
|
-
export declare function forEachEmbeddedDocument(context: LanguageServiceContext,
|
|
14
|
+
export declare function forEachEmbeddedDocument(context: LanguageServiceContext, sourceScript: SourceScript<URI>, current: VirtualCode): Generator<DocumentsAndMap>;
|
|
10
15
|
export declare function getEmbeddedFilesByLevel(context: LanguageServiceContext, sourceFileUri: URI, rootFile: VirtualCode, level: number): VirtualCode[];
|
|
16
|
+
export declare function getSourceRange(docs: DocumentsAndMap, range: vscode.Range, filter?: (data: CodeInformation) => boolean): {
|
|
17
|
+
start: import("vscode-languageserver-textdocument").Position;
|
|
18
|
+
end: import("vscode-languageserver-textdocument").Position;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function getGeneratedRange(docs: DocumentsAndMap, range: vscode.Range, filter?: (data: CodeInformation) => boolean): {
|
|
21
|
+
start: import("vscode-languageserver-textdocument").Position;
|
|
22
|
+
end: import("vscode-languageserver-textdocument").Position;
|
|
23
|
+
} | undefined;
|
|
24
|
+
export declare function getSourceRanges([sourceDocument, embeddedDocument, map]: DocumentsAndMap, range: vscode.Range, filter?: (data: CodeInformation) => boolean): Generator<{
|
|
25
|
+
start: import("vscode-languageserver-textdocument").Position;
|
|
26
|
+
end: import("vscode-languageserver-textdocument").Position;
|
|
27
|
+
}, void, unknown>;
|
|
28
|
+
export declare function getGeneratedRanges([sourceDocument, embeddedDocument, map]: DocumentsAndMap, range: vscode.Range, filter?: (data: CodeInformation) => boolean): Generator<{
|
|
29
|
+
start: import("vscode-languageserver-textdocument").Position;
|
|
30
|
+
end: import("vscode-languageserver-textdocument").Position;
|
|
31
|
+
}, void, unknown>;
|
|
32
|
+
export declare function getSourcePositions([sourceDocument, embeddedDocument, map]: DocumentsAndMap, position: vscode.Position, filter?: (data: CodeInformation) => boolean): Generator<import("vscode-languageserver-textdocument").Position, void, unknown>;
|
|
33
|
+
export declare function getGeneratedPositions([sourceDocument, embeddedDocument, map]: DocumentsAndMap, position: vscode.Position, filter?: (data: CodeInformation) => boolean): Generator<import("vscode-languageserver-textdocument").Position, void, unknown>;
|
|
34
|
+
export declare function getLinkedCodePositions(document: TextDocument, linkedMap: LinkedCodeMap, posotion: vscode.Position): Generator<import("vscode-languageserver-textdocument").Position, void, unknown>;
|