@volar/language-service 1.11.0 → 2.0.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 +3 -4
- package/index.js +5 -5
- package/lib/documents.d.ts +26 -40
- package/lib/documents.js +66 -113
- package/lib/features/provideAutoInsertionEdit.d.ts +6 -0
- package/lib/features/provideAutoInsertionEdit.js +40 -0
- package/lib/{languageFeatures/callHierarchy.d.ts → features/provideCallHierarchyItems.d.ts} +1 -2
- package/lib/{languageFeatures/callHierarchy.js → features/provideCallHierarchyItems.js} +33 -23
- package/lib/{languageFeatures/codeActions.d.ts → features/provideCodeActions.d.ts} +1 -13
- package/lib/features/provideCodeActions.js +111 -0
- package/lib/{languageFeatures/codeLens.d.ts → features/provideCodeLenses.d.ts} +6 -6
- package/lib/features/provideCodeLenses.js +61 -0
- package/lib/{documentFeatures/colorPresentations.d.ts → features/provideColorPresentations.d.ts} +0 -1
- package/lib/features/provideColorPresentations.js +46 -0
- package/lib/{languageFeatures/complete.d.ts → features/provideCompletionItems.d.ts} +1 -2
- package/lib/{languageFeatures/complete.js → features/provideCompletionItems.js} +45 -37
- package/lib/features/provideDefinition.d.ts +4 -0
- package/lib/{languageFeatures/definition.js → features/provideDefinition.js} +48 -45
- package/lib/{languageFeatures/validation.d.ts → features/provideDiagnostics.d.ts} +2 -4
- package/lib/{languageFeatures/validation.js → features/provideDiagnostics.js} +30 -124
- package/lib/{documentFeatures/documentColors.d.ts → features/provideDocumentColors.d.ts} +1 -2
- package/lib/features/provideDocumentColors.js +34 -0
- package/lib/features/provideDocumentDropEdits.d.ts +3 -0
- package/lib/features/provideDocumentDropEdits.js +27 -0
- package/lib/{documentFeatures/format.d.ts → features/provideDocumentFormattingEdits.d.ts} +0 -1
- package/lib/{documentFeatures/format.js → features/provideDocumentFormattingEdits.js} +76 -71
- package/lib/{languageFeatures/documentHighlights.d.ts → features/provideDocumentHighlights.d.ts} +0 -1
- package/lib/{languageFeatures/documentHighlights.js → features/provideDocumentHighlights.js} +17 -16
- package/lib/{languageFeatures/documentLinks.d.ts → features/provideDocumentLinks.d.ts} +1 -2
- package/lib/features/provideDocumentLinks.js +50 -0
- package/lib/{languageFeatures/documentSemanticTokens.d.ts → features/provideDocumentSemanticTokens.d.ts} +1 -2
- package/lib/features/provideDocumentSemanticTokens.js +84 -0
- package/lib/{documentFeatures/documentSymbols.d.ts → features/provideDocumentSymbols.d.ts} +0 -1
- package/lib/{documentFeatures/documentSymbols.js → features/provideDocumentSymbols.js} +15 -10
- package/lib/{languageFeatures/fileReferences.d.ts → features/provideFileReferences.d.ts} +0 -1
- package/lib/features/provideFileReferences.js +35 -0
- package/lib/{languageFeatures/fileRename.d.ts → features/provideFileRenameEdits.d.ts} +0 -1
- package/lib/{languageFeatures/fileRename.js → features/provideFileRenameEdits.js} +12 -12
- package/lib/{documentFeatures/foldingRanges.d.ts → features/provideFoldingRanges.d.ts} +0 -1
- package/lib/features/provideFoldingRanges.js +24 -0
- package/lib/{languageFeatures/hover.d.ts → features/provideHover.d.ts} +0 -1
- package/lib/{languageFeatures/hover.js → features/provideHover.js} +11 -11
- package/lib/{languageFeatures/inlayHints.d.ts → features/provideInlayHints.d.ts} +1 -2
- package/lib/features/provideInlayHints.js +84 -0
- package/lib/{documentFeatures/linkedEditingRanges.d.ts → features/provideLinkedEditingRanges.d.ts} +0 -1
- package/lib/features/provideLinkedEditingRanges.js +32 -0
- package/lib/{languageFeatures/references.d.ts → features/provideReferences.d.ts} +0 -1
- package/lib/{languageFeatures/references.js → features/provideReferences.js} +14 -13
- package/lib/{languageFeatures/rename.d.ts → features/provideRenameEdits.d.ts} +0 -3
- package/lib/features/provideRenameEdits.js +126 -0
- package/lib/{languageFeatures/renamePrepare.d.ts → features/provideRenameRange.d.ts} +2 -3
- package/lib/{languageFeatures/renamePrepare.js → features/provideRenameRange.js} +7 -5
- package/lib/{documentFeatures/selectionRanges.d.ts → features/provideSelectionRanges.d.ts} +1 -2
- package/lib/{documentFeatures/selectionRanges.js → features/provideSelectionRanges.js} +18 -15
- package/lib/{languageFeatures/signatureHelp.d.ts → features/provideSignatureHelp.d.ts} +0 -1
- package/lib/{languageFeatures/signatureHelp.js → features/provideSignatureHelp.js} +8 -6
- package/lib/{languageFeatures/workspaceSymbols.d.ts → features/provideWorkspaceSymbols.d.ts} +0 -1
- package/lib/{languageFeatures/workspaceSymbols.js → features/provideWorkspaceSymbols.js} +15 -11
- package/lib/{languageFeatures/codeActionResolve.d.ts → features/resolveCodeAction.d.ts} +0 -1
- package/lib/features/resolveCodeAction.js +27 -0
- package/lib/{languageFeatures/codeLensResolve.d.ts → features/resolveCodeLens.d.ts} +0 -1
- package/lib/features/resolveCodeLens.js +39 -0
- package/lib/{languageFeatures/completeResolve.d.ts → features/resolveCompletionItem.d.ts} +0 -1
- package/lib/features/resolveCompletionItem.js +35 -0
- package/lib/{languageFeatures/documentLinkResolve.d.ts → features/resolveDocumentLink.d.ts} +0 -1
- package/lib/{languageFeatures/documentLinkResolve.js → features/resolveDocumentLink.js} +12 -10
- package/lib/{languageFeatures/inlayHintResolve.d.ts → features/resolveInlayHint.d.ts} +0 -1
- package/lib/{languageFeatures/inlayHintResolve.js → features/resolveInlayHint.js} +4 -4
- package/lib/languageService.d.ts +61 -0
- package/lib/languageService.js +158 -0
- package/lib/types.d.ts +88 -137
- package/lib/types.js +1 -8
- package/lib/utils/SemanticTokensBuilder.d.ts +0 -1
- package/lib/utils/cancellation.d.ts +0 -1
- package/lib/utils/common.d.ts +0 -2
- package/lib/utils/common.js +1 -18
- package/lib/utils/dedupe.d.ts +0 -1
- package/lib/utils/featureWorkers.d.ts +7 -8
- package/lib/utils/featureWorkers.js +37 -93
- package/lib/utils/transform.d.ts +19 -0
- package/lib/utils/transform.js +375 -0
- package/package.json +3 -4
- package/lib/baseLanguageService.d.ts +0 -112
- package/lib/baseLanguageService.js +0 -231
- package/lib/documentFeatures/colorPresentations.js +0 -37
- package/lib/documentFeatures/documentColors.js +0 -26
- package/lib/documentFeatures/foldingRanges.js +0 -17
- package/lib/documentFeatures/linkedEditingRanges.js +0 -20
- package/lib/languageFeatures/autoInsert.d.ts +0 -4
- package/lib/languageFeatures/autoInsert.js +0 -42
- package/lib/languageFeatures/codeActionResolve.js +0 -51
- package/lib/languageFeatures/codeActions.js +0 -177
- package/lib/languageFeatures/codeLens.js +0 -53
- package/lib/languageFeatures/codeLensResolve.js +0 -31
- package/lib/languageFeatures/completeResolve.js +0 -32
- package/lib/languageFeatures/definition.d.ts +0 -5
- package/lib/languageFeatures/documentLinks.js +0 -66
- package/lib/languageFeatures/documentSemanticTokens.js +0 -70
- package/lib/languageFeatures/fileReferences.js +0 -32
- package/lib/languageFeatures/inlayHints.js +0 -75
- package/lib/languageFeatures/rename.js +0 -291
- package/lib/transformer/completionItem.d.ts +0 -3
- package/lib/transformer/completionItem.js +0 -18
- package/lib/transformer/completionList.d.ts +0 -3
- package/lib/transformer/completionList.js +0 -27
- package/lib/transformer/documentSymbol.d.ts +0 -3
- package/lib/transformer/documentSymbol.js +0 -24
- package/lib/transformer/foldingRanges.d.ts +0 -3
- package/lib/transformer/foldingRanges.js +0 -24
- package/lib/transformer/hover.d.ts +0 -3
- package/lib/transformer/hover.js +0 -17
- package/lib/transformer/index.d.ts +0 -12
- package/lib/transformer/index.js +0 -26
- package/lib/transformer/locationLike.d.ts +0 -5
- package/lib/transformer/locationLike.js +0 -14
- package/lib/transformer/locationsLike.d.ts +0 -5
- package/lib/transformer/locationsLike.js +0 -12
- package/lib/transformer/selectionRange.d.ts +0 -3
- package/lib/transformer/selectionRange.js +0 -15
- package/lib/transformer/selectionRanges.d.ts +0 -3
- package/lib/transformer/selectionRanges.js +0 -12
- package/lib/transformer/textEdit.d.ts +0 -3
- package/lib/transformer/textEdit.js +0 -72
- package/lib/transformer/workspaceSymbol.d.ts +0 -3
- package/lib/transformer/workspaceSymbol.js +0 -18
- package/lib/utils/definePlugin.d.ts +0 -4
- package/lib/utils/definePlugin.js +0 -20
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Language } from '@volar/language-core';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
+
import type { ServiceContext, ServiceEnvironment, ServicePlugin } from './types';
|
|
4
|
+
export type LanguageService = ReturnType<typeof createLanguageService>;
|
|
5
|
+
export declare function createLanguageService(language: Language, servicePlugins: ServicePlugin[], env: ServiceEnvironment): {
|
|
6
|
+
getTriggerCharacters: () => string[];
|
|
7
|
+
getAutoFormatTriggerCharacters: () => string[];
|
|
8
|
+
getSignatureHelpTriggerCharacters: () => string[];
|
|
9
|
+
getSignatureHelpRetriggerCharacters: () => string[];
|
|
10
|
+
format: (uri: string, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
11
|
+
ch: string;
|
|
12
|
+
position: vscode.Position;
|
|
13
|
+
} | undefined, token?: vscode.CancellationToken) => Promise<vscode.TextEdit[] | undefined>;
|
|
14
|
+
getFoldingRanges: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.FoldingRange[] | undefined>;
|
|
15
|
+
getSelectionRanges: (uri: string, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
16
|
+
findLinkedEditingRanges: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
17
|
+
findDocumentSymbols: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
18
|
+
findDocumentColors: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
19
|
+
getColorPresentations: (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
20
|
+
doValidation: (uri: string, mode: "all" | "semantic" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
|
|
21
|
+
findReferences: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
22
|
+
findFileReferences: (uri: string, token?: vscode.CancellationToken) => import("./types").NullableResult<vscode.Location[]>;
|
|
23
|
+
findDefinition: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
24
|
+
findTypeDefinition: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
25
|
+
findImplementations: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
26
|
+
prepareRename: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Range | {
|
|
27
|
+
range: vscode.Range;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
} | {
|
|
30
|
+
message: string;
|
|
31
|
+
} | undefined>;
|
|
32
|
+
doRename: (uri: string, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
33
|
+
getEditsForFileRename: (oldUri: string, newUri: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
34
|
+
getSemanticTokens: (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, _reportProgress?: ((tokens: vscode.SemanticTokens) => void) | undefined) => Promise<vscode.SemanticTokens | undefined>;
|
|
35
|
+
doHover: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
36
|
+
doComplete: (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
37
|
+
doCodeActions: (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
38
|
+
doCodeActionResolve: (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
39
|
+
doCompletionResolve: (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
40
|
+
getSignatureHelp: (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
41
|
+
doCodeLens: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
|
|
42
|
+
doCodeLensResolve: (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
43
|
+
findDocumentHighlights: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
44
|
+
findDocumentLinks: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
|
|
45
|
+
doDocumentLinkResolve: (item: vscode.DocumentLink, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink>;
|
|
46
|
+
findWorkspaceSymbols: (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
47
|
+
doAutoInsert: (uri: string, position: vscode.Position, lastChange: {
|
|
48
|
+
range: vscode.Range;
|
|
49
|
+
text: string;
|
|
50
|
+
}, token?: vscode.CancellationToken) => Promise<string | vscode.TextEdit | undefined>;
|
|
51
|
+
doDocumentDrop: (uri: string, position: vscode.Position, dataTransfer: Map<string, import("./types").DataTransferItem>, token?: vscode.CancellationToken) => Promise<import("./types").DocumentDropEdit | undefined>;
|
|
52
|
+
getInlayHints: (uri: string, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
53
|
+
doInlayHintResolve: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
54
|
+
callHierarchy: {
|
|
55
|
+
doPrepare(uri: string, position: vscode.Position, token?: vscode.CancellationToken): Promise<vscode.CallHierarchyItem[] | undefined>;
|
|
56
|
+
getIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[]>;
|
|
57
|
+
getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
58
|
+
};
|
|
59
|
+
dispose: () => void;
|
|
60
|
+
context: ServiceContext;
|
|
61
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLanguageService = void 0;
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const documents_1 = require("./documents");
|
|
6
|
+
const autoInsert = require("./features/provideAutoInsertionEdit");
|
|
7
|
+
const callHierarchy = require("./features/provideCallHierarchyItems");
|
|
8
|
+
const codeActions = require("./features/provideCodeActions");
|
|
9
|
+
const codeLens = require("./features/provideCodeLenses");
|
|
10
|
+
const colorPresentations = require("./features/provideColorPresentations");
|
|
11
|
+
const completions = require("./features/provideCompletionItems");
|
|
12
|
+
const definition = require("./features/provideDefinition");
|
|
13
|
+
const diagnostics = require("./features/provideDiagnostics");
|
|
14
|
+
const documentColors = require("./features/provideDocumentColors");
|
|
15
|
+
const documentDrop = require("./features/provideDocumentDropEdits");
|
|
16
|
+
const format = require("./features/provideDocumentFormattingEdits");
|
|
17
|
+
const documentHighlight = require("./features/provideDocumentHighlights");
|
|
18
|
+
const documentLink = require("./features/provideDocumentLinks");
|
|
19
|
+
const semanticTokens = require("./features/provideDocumentSemanticTokens");
|
|
20
|
+
const documentSymbols = require("./features/provideDocumentSymbols");
|
|
21
|
+
const fileReferences = require("./features/provideFileReferences");
|
|
22
|
+
const fileRename = require("./features/provideFileRenameEdits");
|
|
23
|
+
const foldingRanges = require("./features/provideFoldingRanges");
|
|
24
|
+
const hover = require("./features/provideHover");
|
|
25
|
+
const inlayHints = require("./features/provideInlayHints");
|
|
26
|
+
const linkedEditing = require("./features/provideLinkedEditingRanges");
|
|
27
|
+
const references = require("./features/provideReferences");
|
|
28
|
+
const rename = require("./features/provideRenameEdits");
|
|
29
|
+
const renamePrepare = require("./features/provideRenameRange");
|
|
30
|
+
const selectionRanges = require("./features/provideSelectionRanges");
|
|
31
|
+
const signatureHelp = require("./features/provideSignatureHelp");
|
|
32
|
+
const workspaceSymbol = require("./features/provideWorkspaceSymbols");
|
|
33
|
+
const codeActionResolve = require("./features/resolveCodeAction");
|
|
34
|
+
const codeLensResolve = require("./features/resolveCodeLens");
|
|
35
|
+
const completionResolve = require("./features/resolveCompletionItem");
|
|
36
|
+
const documentLinkResolve = require("./features/resolveDocumentLink");
|
|
37
|
+
const inlayHintResolve = require("./features/resolveInlayHint");
|
|
38
|
+
function createLanguageService(language, servicePlugins, env) {
|
|
39
|
+
const context = createServiceContext();
|
|
40
|
+
return {
|
|
41
|
+
getTriggerCharacters: () => servicePlugins.map(service => service.triggerCharacters ?? []).flat(),
|
|
42
|
+
getAutoFormatTriggerCharacters: () => servicePlugins.map(service => service.autoFormatTriggerCharacters ?? []).flat(),
|
|
43
|
+
getSignatureHelpTriggerCharacters: () => servicePlugins.map(service => service.signatureHelpTriggerCharacters ?? []).flat(),
|
|
44
|
+
getSignatureHelpRetriggerCharacters: () => servicePlugins.map(service => service.signatureHelpRetriggerCharacters ?? []).flat(),
|
|
45
|
+
format: format.register(context),
|
|
46
|
+
getFoldingRanges: foldingRanges.register(context),
|
|
47
|
+
getSelectionRanges: selectionRanges.register(context),
|
|
48
|
+
findLinkedEditingRanges: linkedEditing.register(context),
|
|
49
|
+
findDocumentSymbols: documentSymbols.register(context),
|
|
50
|
+
findDocumentColors: documentColors.register(context),
|
|
51
|
+
getColorPresentations: colorPresentations.register(context),
|
|
52
|
+
doValidation: diagnostics.register(context),
|
|
53
|
+
findReferences: references.register(context),
|
|
54
|
+
findFileReferences: fileReferences.register(context),
|
|
55
|
+
findDefinition: definition.register(context, 'provideDefinition', language_core_1.isDefinitionEnabled),
|
|
56
|
+
findTypeDefinition: definition.register(context, 'provideTypeDefinition', language_core_1.isTypeDefinitionEnabled),
|
|
57
|
+
findImplementations: definition.register(context, 'provideImplementation', language_core_1.isImplementationEnabled),
|
|
58
|
+
prepareRename: renamePrepare.register(context),
|
|
59
|
+
doRename: rename.register(context),
|
|
60
|
+
getEditsForFileRename: fileRename.register(context),
|
|
61
|
+
getSemanticTokens: semanticTokens.register(context),
|
|
62
|
+
doHover: hover.register(context),
|
|
63
|
+
doComplete: completions.register(context),
|
|
64
|
+
doCodeActions: codeActions.register(context),
|
|
65
|
+
doCodeActionResolve: codeActionResolve.register(context),
|
|
66
|
+
doCompletionResolve: completionResolve.register(context),
|
|
67
|
+
getSignatureHelp: signatureHelp.register(context),
|
|
68
|
+
doCodeLens: codeLens.register(context),
|
|
69
|
+
doCodeLensResolve: codeLensResolve.register(context),
|
|
70
|
+
findDocumentHighlights: documentHighlight.register(context),
|
|
71
|
+
findDocumentLinks: documentLink.register(context),
|
|
72
|
+
doDocumentLinkResolve: documentLinkResolve.register(context),
|
|
73
|
+
findWorkspaceSymbols: workspaceSymbol.register(context),
|
|
74
|
+
doAutoInsert: autoInsert.register(context),
|
|
75
|
+
doDocumentDrop: documentDrop.register(context),
|
|
76
|
+
getInlayHints: inlayHints.register(context),
|
|
77
|
+
doInlayHintResolve: inlayHintResolve.register(context),
|
|
78
|
+
callHierarchy: callHierarchy.register(context),
|
|
79
|
+
dispose: () => context.services.forEach(service => service[1].dispose?.()),
|
|
80
|
+
context,
|
|
81
|
+
};
|
|
82
|
+
function createServiceContext() {
|
|
83
|
+
const documents = (0, documents_1.createDocumentProvider)(language.files);
|
|
84
|
+
const context = {
|
|
85
|
+
env,
|
|
86
|
+
language: language,
|
|
87
|
+
inject: (key, ...args) => {
|
|
88
|
+
for (const service of context.services) {
|
|
89
|
+
const provide = service[1].provide?.[key];
|
|
90
|
+
if (provide) {
|
|
91
|
+
return provide(...args);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
throw `No service provide ${key}`;
|
|
95
|
+
},
|
|
96
|
+
services: [],
|
|
97
|
+
documents: documents,
|
|
98
|
+
commands: {
|
|
99
|
+
rename: {
|
|
100
|
+
create(uri, position) {
|
|
101
|
+
return {
|
|
102
|
+
title: '',
|
|
103
|
+
command: 'editor.action.rename',
|
|
104
|
+
arguments: [
|
|
105
|
+
uri,
|
|
106
|
+
position,
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
is(command) {
|
|
111
|
+
return command.command === 'editor.action.rename';
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
showReferences: {
|
|
115
|
+
create(uri, position, locations) {
|
|
116
|
+
return {
|
|
117
|
+
title: locations.length === 1 ? '1 reference' : `${locations.length} references`,
|
|
118
|
+
command: 'editor.action.showReferences',
|
|
119
|
+
arguments: [
|
|
120
|
+
uri,
|
|
121
|
+
position,
|
|
122
|
+
locations,
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
is(command) {
|
|
127
|
+
return command.command === 'editor.action.showReferences';
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
setSelection: {
|
|
131
|
+
create(position) {
|
|
132
|
+
return {
|
|
133
|
+
title: '',
|
|
134
|
+
command: 'setSelection',
|
|
135
|
+
arguments: [{
|
|
136
|
+
selection: {
|
|
137
|
+
selectionStartLineNumber: position.line + 1,
|
|
138
|
+
positionLineNumber: position.line + 1,
|
|
139
|
+
selectionStartColumn: position.character + 1,
|
|
140
|
+
positionColumn: position.character + 1,
|
|
141
|
+
},
|
|
142
|
+
}],
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
is(command) {
|
|
146
|
+
return command.command === 'setSelection';
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
for (const servicePlugin of servicePlugins) {
|
|
152
|
+
context.services.push([servicePlugin, servicePlugin.create(context)]);
|
|
153
|
+
}
|
|
154
|
+
return context;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.createLanguageService = createLanguageService;
|
|
158
|
+
//# sourceMappingURL=languageService.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { Language
|
|
1
|
+
import type { Language } from '@volar/language-core';
|
|
2
2
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
import { URI } from 'vscode-uri';
|
|
5
|
-
import {
|
|
4
|
+
import type { URI } from 'vscode-uri';
|
|
5
|
+
import type { DocumentProvider } from './documents';
|
|
6
6
|
export type * from 'vscode-languageserver-protocol';
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export interface ServiceEnvironment extends RuntimeEnvironment {
|
|
8
|
+
workspaceFolder: {
|
|
9
|
+
name: string;
|
|
10
|
+
uri: URI;
|
|
11
|
+
};
|
|
11
12
|
locale?: string;
|
|
12
|
-
workspaceUri: URI;
|
|
13
|
-
rootUri: URI;
|
|
14
13
|
clientCapabilities?: vscode.ClientCapabilities;
|
|
15
14
|
getConfiguration?<T>(section: string, scopeUri?: string): Promise<T | undefined>;
|
|
16
15
|
onDidChangeConfiguration?(cb: () => void): vscode.Disposable;
|
|
17
16
|
onDidChangeWatchedFiles?(cb: (params: vscode.DidChangeWatchedFilesParams) => void): vscode.Disposable;
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeEnvironment {
|
|
18
19
|
uriToFileName(uri: string): string;
|
|
19
20
|
fileNameToUri(fileName: string): string;
|
|
20
21
|
fs?: FileSystem;
|
|
@@ -47,147 +48,97 @@ interface Command<T> {
|
|
|
47
48
|
create: T;
|
|
48
49
|
is(value: vscode.Command): boolean;
|
|
49
50
|
}
|
|
50
|
-
export interface ServiceContext
|
|
51
|
+
export interface ServiceContext {
|
|
51
52
|
env: ServiceEnvironment;
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
language: Language;
|
|
54
|
+
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>;
|
|
54
55
|
commands: {
|
|
55
56
|
showReferences: Command<(uri: string, position: vscode.Position, locations: vscode.Location[]) => vscode.Command | undefined>;
|
|
56
57
|
rename: Command<(uri: string, position: vscode.Position) => vscode.Command | undefined>;
|
|
57
58
|
setSelection: Command<(position: vscode.Position) => vscode.Command | undefined>;
|
|
58
59
|
};
|
|
59
|
-
documents:
|
|
60
|
-
|
|
61
|
-
[id: string]: Rule;
|
|
62
|
-
};
|
|
63
|
-
services: {
|
|
64
|
-
[id: string]: ReturnType<Service>;
|
|
65
|
-
};
|
|
66
|
-
ruleFixes?: {
|
|
67
|
-
[uri: string]: {
|
|
68
|
-
[ruleId: string]: {
|
|
69
|
-
[ruleFixId: number]: [vscode.Diagnostic, RuleFix[]];
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
60
|
+
documents: DocumentProvider;
|
|
61
|
+
services: [ServicePlugin, ServicePluginInstance][];
|
|
73
62
|
}
|
|
74
63
|
export type Result<T> = T | Thenable<T>;
|
|
75
64
|
export type NullableResult<T> = Result<T | undefined | null>;
|
|
76
65
|
export type SemanticToken = [number, number, number, number, number];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Range[]>;
|
|
126
|
-
provideAutoInsertionEdit?(document: TextDocument, position: vscode.Position, context: AutoInsertionContext, token: vscode.CancellationToken): NullableResult<string | vscode.TextEdit>;
|
|
127
|
-
provideFileRenameEdits?(oldUri: string, newUri: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
128
|
-
provideFormattingIndentSensitiveLines?(document: TextDocument, token: vscode.CancellationToken): NullableResult<number[]>;
|
|
129
|
-
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Result<vscode.CodeLens>;
|
|
130
|
-
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): Result<vscode.CodeAction>;
|
|
131
|
-
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): Result<vscode.CompletionItem>;
|
|
132
|
-
resolveDocumentLink?(link: vscode.DocumentLink, token: vscode.CancellationToken): Result<vscode.DocumentLink>;
|
|
133
|
-
resolveInlayHint?(inlayHint: vscode.InlayHint, token: vscode.CancellationToken): Result<vscode.InlayHint>;
|
|
134
|
-
resolveReferencesCodeLensLocations?(document: TextDocument, range: vscode.Range, references: vscode.Location[], token: vscode.CancellationToken): Result<vscode.Location[]>;
|
|
135
|
-
transformCompletionItem?(item: vscode.CompletionItem): vscode.CompletionItem | undefined;
|
|
136
|
-
transformCodeAction?(item: vscode.CodeAction): vscode.CodeAction | undefined;
|
|
137
|
-
dispose?(): void;
|
|
138
|
-
} & ServiceProvide<P>;
|
|
139
|
-
};
|
|
140
|
-
export interface AutoInsertionContext {
|
|
141
|
-
lastChange: {
|
|
66
|
+
export interface ServicePlugin {
|
|
67
|
+
triggerCharacters?: string[];
|
|
68
|
+
signatureHelpTriggerCharacters?: string[];
|
|
69
|
+
signatureHelpRetriggerCharacters?: string[];
|
|
70
|
+
autoFormatTriggerCharacters?: string[];
|
|
71
|
+
create(context: ServiceContext): ServicePluginInstance;
|
|
72
|
+
}
|
|
73
|
+
export interface ServicePluginInstance<P = any> {
|
|
74
|
+
provide?: P;
|
|
75
|
+
isAdditionalCompletion?: boolean;
|
|
76
|
+
provideHover?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Hover>;
|
|
77
|
+
provideDocumentSymbols?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentSymbol[]>;
|
|
78
|
+
provideDocumentHighlights?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.DocumentHighlight[]>;
|
|
79
|
+
provideLinkedEditingRanges?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LinkedEditingRanges>;
|
|
80
|
+
provideDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
81
|
+
provideTypeDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
82
|
+
provideImplementation?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
83
|
+
provideCodeLenses?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.CodeLens[]>;
|
|
84
|
+
provideCodeActions?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken): NullableResult<vscode.CodeAction[]>;
|
|
85
|
+
provideDocumentFormattingEdits?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
86
|
+
provideOnTypeFormattingEdits?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
87
|
+
provideDocumentLinks?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentLink[]>;
|
|
88
|
+
provideCompletionItems?(document: TextDocument, position: vscode.Position, context: vscode.CompletionContext, token: vscode.CancellationToken): NullableResult<vscode.CompletionList>;
|
|
89
|
+
provideDocumentColors?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.ColorInformation[]>;
|
|
90
|
+
provideColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.ColorPresentation[]>;
|
|
91
|
+
provideFoldingRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.FoldingRange[]>;
|
|
92
|
+
provideSignatureHelp?(document: TextDocument, position: vscode.Position, context: vscode.SignatureHelpContext, token: vscode.CancellationToken): NullableResult<vscode.SignatureHelp>;
|
|
93
|
+
provideRenameRange?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Range | {
|
|
94
|
+
range: vscode.Range;
|
|
95
|
+
placeholder: string;
|
|
96
|
+
} | {
|
|
97
|
+
message: string;
|
|
98
|
+
}>;
|
|
99
|
+
provideRenameEdits?(document: TextDocument, position: vscode.Position, newName: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
100
|
+
provideReferences?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
101
|
+
provideSelectionRanges?(document: TextDocument, positions: vscode.Position[], token: vscode.CancellationToken): NullableResult<vscode.SelectionRange[]>;
|
|
102
|
+
provideInlayHints?(document: TextDocument, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.InlayHint[]>;
|
|
103
|
+
provideCallHierarchyItems?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.CallHierarchyItem[]>;
|
|
104
|
+
provideCallHierarchyIncomingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyIncomingCall[]>;
|
|
105
|
+
provideCallHierarchyOutgoingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyOutgoingCall[]>;
|
|
106
|
+
provideDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend, token: vscode.CancellationToken): NullableResult<SemanticToken[]>;
|
|
107
|
+
provideWorkspaceSymbols?(query: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceSymbol[]>;
|
|
108
|
+
provideDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
109
|
+
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
110
|
+
provideDiagnosticMarkupContent?(diagnostic: vscode.Diagnostic, token: vscode.CancellationToken): NullableResult<vscode.MarkupContent>;
|
|
111
|
+
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
112
|
+
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Range[]>;
|
|
113
|
+
provideAutoInsertionEdit?(document: TextDocument, position: vscode.Position, lastChange: {
|
|
142
114
|
range: vscode.Range;
|
|
143
|
-
rangeOffset: number;
|
|
144
|
-
rangeLength: number;
|
|
145
115
|
text: string;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
116
|
+
}, token: vscode.CancellationToken): NullableResult<string | vscode.TextEdit>;
|
|
117
|
+
provideFileRenameEdits?(oldUri: string, newUri: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
118
|
+
provideFormattingIndentSensitiveLines?(document: TextDocument, token: vscode.CancellationToken): NullableResult<number[]>;
|
|
119
|
+
provideDocumentDropEdits?(document: TextDocument, position: vscode.Position, dataTransfer: Map<string, DataTransferItem>, token: vscode.CancellationToken): NullableResult<DocumentDropEdit>;
|
|
120
|
+
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Result<vscode.CodeLens>;
|
|
121
|
+
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): Result<vscode.CodeAction>;
|
|
122
|
+
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): Result<vscode.CompletionItem>;
|
|
123
|
+
resolveDocumentLink?(link: vscode.DocumentLink, token: vscode.CancellationToken): Result<vscode.DocumentLink>;
|
|
124
|
+
resolveInlayHint?(inlayHint: vscode.InlayHint, token: vscode.CancellationToken): Result<vscode.InlayHint>;
|
|
125
|
+
resolveReferencesCodeLensLocations?(document: TextDocument, range: vscode.Range, references: vscode.Location[], token: vscode.CancellationToken): Result<vscode.Location[]>;
|
|
126
|
+
transformCompletionItem?(item: vscode.CompletionItem): vscode.CompletionItem | undefined;
|
|
127
|
+
transformCodeAction?(item: vscode.CodeAction): vscode.CodeAction | undefined;
|
|
128
|
+
dispose?(): void;
|
|
152
129
|
}
|
|
153
|
-
export interface
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export interface RuleContext<Provide = any> {
|
|
158
|
-
env: ServiceEnvironment;
|
|
159
|
-
inject<K extends 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>;
|
|
160
|
-
report(error: vscode.Diagnostic, ...fixes: RuleFix[]): void;
|
|
130
|
+
export interface DocumentDropEdit {
|
|
131
|
+
insertText: string;
|
|
132
|
+
insertTextFormat: vscode.InsertTextFormat;
|
|
133
|
+
additionalEdit?: vscode.WorkspaceEdit;
|
|
161
134
|
}
|
|
162
|
-
export interface
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
* See https://code.visualstudio.com/api/references/vscode-api#CodeActionKind
|
|
167
|
-
*/
|
|
168
|
-
kinds?: vscode.CodeActionKind[];
|
|
169
|
-
/**
|
|
170
|
-
* Title of the code action.
|
|
171
|
-
*/
|
|
172
|
-
title?: string;
|
|
173
|
-
/**
|
|
174
|
-
* Edit to apply to the document.
|
|
175
|
-
*/
|
|
176
|
-
getEdits?(diagnostic: vscode.Diagnostic): NullableResult<vscode.TextEdit[]>;
|
|
177
|
-
/**
|
|
178
|
-
* Cross-file edits to apply to the workspace.
|
|
179
|
-
*/
|
|
180
|
-
getWorkspaceEdit?(diagnostic: vscode.Diagnostic): NullableResult<vscode.WorkspaceEdit>;
|
|
135
|
+
export interface DataTransferItem {
|
|
136
|
+
value: any;
|
|
137
|
+
asString(): Thenable<string>;
|
|
138
|
+
asFile(): DataTransferFile | undefined;
|
|
181
139
|
}
|
|
182
|
-
export interface
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
services?: {
|
|
187
|
-
[id: string]: Service;
|
|
188
|
-
};
|
|
189
|
-
rules?: {
|
|
190
|
-
[id: string]: Rule;
|
|
191
|
-
};
|
|
140
|
+
export interface DataTransferFile {
|
|
141
|
+
name: string;
|
|
142
|
+
uri?: string;
|
|
143
|
+
data(): Thenable<Uint8Array>;
|
|
192
144
|
}
|
|
193
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FileType = void 0;
|
|
4
4
|
var FileType;
|
|
5
5
|
(function (FileType) {
|
|
6
6
|
FileType[FileType["Unknown"] = 0] = "Unknown";
|
|
@@ -8,11 +8,4 @@ var FileType;
|
|
|
8
8
|
FileType[FileType["Directory"] = 2] = "Directory";
|
|
9
9
|
FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
|
|
10
10
|
})(FileType || (exports.FileType = FileType = {}));
|
|
11
|
-
var RuleType;
|
|
12
|
-
(function (RuleType) {
|
|
13
|
-
RuleType[RuleType["Format"] = 0] = "Format";
|
|
14
|
-
RuleType[RuleType["Syntax"] = 1] = "Syntax";
|
|
15
|
-
RuleType[RuleType["Semantic"] = 2] = "Semantic";
|
|
16
|
-
})(RuleType || (exports.RuleType = RuleType = {}));
|
|
17
|
-
;
|
|
18
11
|
//# sourceMappingURL=types.js.map
|
package/lib/utils/common.d.ts
CHANGED
|
@@ -6,7 +6,5 @@ export declare function getOverlapRange(range1Start: number, range1End: number,
|
|
|
6
6
|
} | undefined;
|
|
7
7
|
export declare function isInsideRange(parent: vscode.Range, child: vscode.Range): boolean;
|
|
8
8
|
export declare function stringToSnapshot(str: string): ts.IScriptSnapshot;
|
|
9
|
-
export declare function resolveCommonLanguageId(uri: string): string;
|
|
10
9
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
11
10
|
export declare function notEmpty<T>(value: T | null | undefined): value is T;
|
|
12
|
-
//# sourceMappingURL=common.d.ts.map
|
package/lib/utils/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.notEmpty = exports.sleep = exports.
|
|
3
|
+
exports.notEmpty = exports.sleep = exports.stringToSnapshot = exports.isInsideRange = exports.getOverlapRange = void 0;
|
|
4
4
|
function getOverlapRange(range1Start, range1End, range2Start, range2End) {
|
|
5
5
|
const start = Math.max(range1Start, range2Start);
|
|
6
6
|
const end = Math.min(range1End, range2End);
|
|
@@ -32,23 +32,6 @@ function stringToSnapshot(str) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
exports.stringToSnapshot = stringToSnapshot;
|
|
35
|
-
function resolveCommonLanguageId(uri) {
|
|
36
|
-
const ext = uri.split('.').pop();
|
|
37
|
-
switch (ext) {
|
|
38
|
-
case 'js': return 'javascript';
|
|
39
|
-
case 'cjs': return 'javascript';
|
|
40
|
-
case 'mjs': return 'javascript';
|
|
41
|
-
case 'ts': return 'typescript';
|
|
42
|
-
case 'cts': return 'typescript';
|
|
43
|
-
case 'mts': return 'typescript';
|
|
44
|
-
case 'jsx': return 'javascriptreact';
|
|
45
|
-
case 'tsx': return 'typescriptreact';
|
|
46
|
-
case 'pug': return 'jade';
|
|
47
|
-
case 'md': return 'markdown';
|
|
48
|
-
}
|
|
49
|
-
return ext;
|
|
50
|
-
}
|
|
51
|
-
exports.resolveCommonLanguageId = resolveCommonLanguageId;
|
|
52
35
|
function sleep(ms) {
|
|
53
36
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
54
37
|
}
|
package/lib/utils/dedupe.d.ts
CHANGED
|
@@ -12,4 +12,3 @@ export declare function withLocationLinks<T extends vscode.LocationLink>(items:
|
|
|
12
12
|
export declare function withCallHierarchyIncomingCalls<T extends vscode.CallHierarchyIncomingCall>(items: T[]): T[];
|
|
13
13
|
export declare function withCallHierarchyOutgoingCalls<T extends vscode.CallHierarchyOutgoingCall>(items: T[]): T[];
|
|
14
14
|
export declare function withRanges<T extends vscode.Range>(items: T[]): T[];
|
|
15
|
-
//# sourceMappingURL=dedupe.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type { CodeInformation, VirtualFile } from '@volar/language-core';
|
|
1
2
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function safeCall<T>(cb: () => Promise<T> | T, errorMsg?: string): Promise<T | undefined>;
|
|
9
|
-
//# sourceMappingURL=featureWorkers.d.ts.map
|
|
3
|
+
import type { SourceMapWithDocuments } from '../documents';
|
|
4
|
+
import type { ServiceContext, ServicePluginInstance, ServicePlugin } from '../types';
|
|
5
|
+
export declare function documentFeatureWorker<T>(context: ServiceContext, uri: string, valid: (map: SourceMapWithDocuments<CodeInformation>) => boolean, worker: (service: [ServicePlugin, ServicePluginInstance], document: TextDocument) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: SourceMapWithDocuments<CodeInformation>) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
6
|
+
export declare function languageFeatureWorker<T, K>(context: ServiceContext, uri: string, getReadDocParams: () => K, eachVirtualDocParams: (map: SourceMapWithDocuments<CodeInformation>) => Generator<K>, worker: (service: [ServicePlugin, ServicePluginInstance], document: TextDocument, params: K, map?: SourceMapWithDocuments<CodeInformation>) => Thenable<T | null | undefined> | T | null | undefined, transformResult: (result: T, map?: SourceMapWithDocuments<CodeInformation>) => T | undefined, combineResult?: (results: T[]) => T): Promise<T | undefined>;
|
|
7
|
+
export declare function safeCall<T>(cb: () => Thenable<T> | T, errorMsg?: string): Promise<T | undefined>;
|
|
8
|
+
export declare function visitEmbedded(context: ServiceContext, current: VirtualFile, cb: (file: VirtualFile, sourceMap: SourceMapWithDocuments<CodeInformation>) => Promise<boolean>, rootFile?: VirtualFile): Promise<boolean>;
|