@volar/language-service 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/baseDocumentService.d.ts +15 -16
- package/out/baseDocumentService.js +4 -4
- package/out/baseLanguageService.d.ts +35 -36
- package/out/baseLanguageService.js +4 -4
- package/out/documents.d.ts +18 -18
- package/out/index.d.ts +0 -1
- package/out/index.js +0 -1
- package/out/languageFeatures/callHierarchy.js +2 -2
- package/out/languageFeatures/documentSemanticTokens.d.ts +1 -1
- package/out/languageFeatures/documentSemanticTokens.js +1 -3
- package/out/languageFeatures/validation.d.ts +1 -1
- package/out/languageFeatures/validation.js +14 -32
- package/out/types.d.ts +93 -1
- package/out/types.js +1 -0
- package/package.json +7 -8
- package/out/plugin.d.ts +0 -93
- package/out/plugin.js +0 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmbeddedLanguageModule } from '@volar/language-core';
|
|
2
2
|
import * as shared from '@volar/shared';
|
|
3
3
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
import { LanguageServicePlugin } from './
|
|
5
|
-
import
|
|
6
|
-
import type * as _0 from 'vscode-languageserver-protocol';
|
|
4
|
+
import { DocumentServiceRuntimeContext, LanguageServicePlugin, LanguageServicePluginContext } from './types';
|
|
5
|
+
import type * as _ from 'vscode-languageserver-protocol';
|
|
7
6
|
export type DocumentService = ReturnType<typeof createDocumentService>;
|
|
8
7
|
export declare function createDocumentServiceContext(options: {
|
|
9
8
|
ts: typeof import('typescript/lib/tsserverlibrary');
|
|
@@ -13,23 +12,23 @@ export declare function createDocumentServiceContext(options: {
|
|
|
13
12
|
}): DocumentServiceRuntimeContext;
|
|
14
13
|
export declare function isTsDocument(document: TextDocument): boolean;
|
|
15
14
|
export declare function createDocumentService(context: DocumentServiceRuntimeContext): {
|
|
16
|
-
format: (document: shared.
|
|
15
|
+
format: (document: shared._1.TextDocument, options: _.FormattingOptions, range?: _.Range | undefined, onTypeParams?: {
|
|
17
16
|
ch: string;
|
|
18
|
-
position:
|
|
19
|
-
} | undefined) => Promise<
|
|
20
|
-
getFoldingRanges: (document: shared.
|
|
21
|
-
getSelectionRanges: (document: shared.
|
|
22
|
-
findLinkedEditingRanges: (document: shared.
|
|
23
|
-
findDocumentSymbols: (document: shared.
|
|
24
|
-
findDocumentColors: (document: shared.
|
|
25
|
-
getColorPresentations: (document: shared.
|
|
26
|
-
doAutoInsert: (document: shared.
|
|
17
|
+
position: _.Position;
|
|
18
|
+
} | undefined) => Promise<_.TextEdit[] | undefined>;
|
|
19
|
+
getFoldingRanges: (document: shared._1.TextDocument) => Promise<_.FoldingRange[] | undefined>;
|
|
20
|
+
getSelectionRanges: (document: shared._1.TextDocument, positions: _.Position[]) => Promise<_.SelectionRange[] | undefined>;
|
|
21
|
+
findLinkedEditingRanges: (document: shared._1.TextDocument, position: _.Position) => Promise<_.LinkedEditingRanges | undefined>;
|
|
22
|
+
findDocumentSymbols: (document: shared._1.TextDocument) => Promise<_.SymbolInformation[] | undefined>;
|
|
23
|
+
findDocumentColors: (document: shared._1.TextDocument) => Promise<_.ColorInformation[] | undefined>;
|
|
24
|
+
getColorPresentations: (document: shared._1.TextDocument, color: _.Color, range: _.Range) => Promise<_.ColorPresentation[] | undefined>;
|
|
25
|
+
doAutoInsert: (document: shared._1.TextDocument, position: _.Position, options: {
|
|
27
26
|
lastChange: {
|
|
28
|
-
range:
|
|
27
|
+
range: _.Range;
|
|
29
28
|
rangeOffset: number;
|
|
30
29
|
rangeLength: number;
|
|
31
30
|
text: string;
|
|
32
31
|
};
|
|
33
|
-
}) => Promise<NonNullable<string |
|
|
32
|
+
}) => Promise<NonNullable<string | _.TextEdit | null | undefined> | undefined>;
|
|
34
33
|
context: DocumentServiceRuntimeContext;
|
|
35
34
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.createDocumentService = exports.isTsDocument = exports.createDocumentServiceContext = void 0;
|
|
3
|
+
const language_core_1 = require("@volar/language-core");
|
|
4
|
+
const shared = require("@volar/shared");
|
|
5
|
+
const reactivity_1 = require("@vue/reactivity");
|
|
3
6
|
const autoInsert = require("./documentFeatures/autoInsert");
|
|
4
7
|
const colorPresentations = require("./documentFeatures/colorPresentations");
|
|
5
8
|
const documentColors = require("./documentFeatures/documentColors");
|
|
@@ -8,11 +11,8 @@ const foldingRanges = require("./documentFeatures/foldingRanges");
|
|
|
8
11
|
const format = require("./documentFeatures/format");
|
|
9
12
|
const linkedEditingRanges = require("./documentFeatures/linkedEditingRanges");
|
|
10
13
|
const selectionRanges = require("./documentFeatures/selectionRanges");
|
|
11
|
-
const shared = require("@volar/shared");
|
|
12
|
-
const singleFileTypeScriptService_1 = require("./utils/singleFileTypeScriptService");
|
|
13
|
-
const language_core_1 = require("@volar/language-core");
|
|
14
14
|
const documents_1 = require("./documents");
|
|
15
|
-
const
|
|
15
|
+
const singleFileTypeScriptService_1 = require("./utils/singleFileTypeScriptService");
|
|
16
16
|
function createDocumentServiceContext(options) {
|
|
17
17
|
const ts = options.ts;
|
|
18
18
|
let plugins;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createEmbeddedLanguageServiceHost, LanguageServiceHost } from '@volar/language-core';
|
|
2
2
|
import * as executeCommand from './languageFeatures/executeCommand';
|
|
3
|
-
import { LanguageServicePlugin } from './
|
|
4
|
-
import
|
|
5
|
-
import type * as _0 from 'vscode-languageserver-protocol';
|
|
3
|
+
import { LanguageServicePlugin, LanguageServicePluginContext, LanguageServiceRuntimeContext } from './types';
|
|
4
|
+
import type * as _ from 'vscode-languageserver-protocol';
|
|
6
5
|
export type LanguageService = ReturnType<typeof createLanguageService>;
|
|
7
6
|
export declare function createLanguageServiceContext(options: {
|
|
8
7
|
host: LanguageServiceHost;
|
|
@@ -10,47 +9,47 @@ export declare function createLanguageServiceContext(options: {
|
|
|
10
9
|
getPlugins(): LanguageServicePlugin[];
|
|
11
10
|
env: LanguageServicePluginContext['env'];
|
|
12
11
|
documentRegistry: ts.DocumentRegistry | undefined;
|
|
13
|
-
}):
|
|
14
|
-
export declare function createLanguageService(context:
|
|
15
|
-
doValidation: (uri: string, response?: ((result:
|
|
16
|
-
findReferences: (uri: string, position:
|
|
17
|
-
findFileReferences: (uri: string) => import("./
|
|
18
|
-
findDefinition: (uri: string, position:
|
|
19
|
-
findTypeDefinition: (uri: string, position:
|
|
20
|
-
findImplementations: (uri: string, position:
|
|
21
|
-
prepareRename: (uri: string, position:
|
|
22
|
-
doRename: (uri: string, position:
|
|
23
|
-
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<
|
|
24
|
-
getSemanticTokens: (uri: string, range
|
|
25
|
-
doHover: (uri: string, position:
|
|
26
|
-
doComplete: (uri: string, position:
|
|
12
|
+
}): LanguageServiceRuntimeContext;
|
|
13
|
+
export declare function createLanguageService(context: LanguageServiceRuntimeContext): {
|
|
14
|
+
doValidation: (uri: string, token?: _.CancellationToken | undefined, response?: ((result: _.Diagnostic[]) => void) | undefined) => Promise<_.Diagnostic[]>;
|
|
15
|
+
findReferences: (uri: string, position: _.Position) => Promise<_.Location[] | undefined>;
|
|
16
|
+
findFileReferences: (uri: string) => import("./types").NullableResult<_.Location[]>;
|
|
17
|
+
findDefinition: (uri: string, position: _.Position) => Promise<_.LocationLink[] | undefined>;
|
|
18
|
+
findTypeDefinition: (uri: string, position: _.Position) => Promise<_.LocationLink[] | undefined>;
|
|
19
|
+
findImplementations: (uri: string, position: _.Position) => Promise<_.LocationLink[] | undefined>;
|
|
20
|
+
prepareRename: (uri: string, position: _.Position) => Promise<NonNullable<_.Range | _.ResponseError<void> | null | undefined> | undefined>;
|
|
21
|
+
doRename: (uri: string, position: _.Position, newName: string) => Promise<_.WorkspaceEdit | undefined>;
|
|
22
|
+
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<_.WorkspaceEdit | undefined>;
|
|
23
|
+
getSemanticTokens: (uri: string, range: _.Range | undefined, cancleToken: _.CancellationToken, reportProgress?: ((tokens: import("./types").SemanticToken[]) => void) | undefined) => Promise<import("./types").SemanticToken[] | undefined> | undefined;
|
|
24
|
+
doHover: (uri: string, position: _.Position) => Promise<_.Hover | undefined>;
|
|
25
|
+
doComplete: (uri: string, position: _.Position, completionContext?: _.CompletionContext | undefined) => Promise<{
|
|
27
26
|
isIncomplete: boolean;
|
|
28
|
-
items:
|
|
27
|
+
items: _.CompletionItem[];
|
|
29
28
|
}>;
|
|
30
|
-
doCodeActions: (uri: string, range:
|
|
31
|
-
doCodeActionResolve: (item:
|
|
32
|
-
doCompletionResolve: (item:
|
|
33
|
-
getSignatureHelp: (uri: string, position:
|
|
34
|
-
doCodeLens: (uri: string) => Promise<
|
|
35
|
-
doCodeLensResolve: (item:
|
|
36
|
-
findDocumentHighlights: (uri: string, position:
|
|
37
|
-
findDocumentLinks: (uri: string) => Promise<
|
|
38
|
-
findWorkspaceSymbols: (query: string) => Promise<
|
|
39
|
-
doAutoInsert: (uri: string, position:
|
|
29
|
+
doCodeActions: (uri: string, range: _.Range, codeActionContext: _.CodeActionContext) => Promise<_.CodeAction[] | undefined>;
|
|
30
|
+
doCodeActionResolve: (item: _.CodeAction) => Promise<_.CodeAction>;
|
|
31
|
+
doCompletionResolve: (item: _.CompletionItem) => Promise<_.CompletionItem>;
|
|
32
|
+
getSignatureHelp: (uri: string, position: _.Position, signatureHelpContext?: _.SignatureHelpContext | undefined) => Promise<_.SignatureHelp | undefined>;
|
|
33
|
+
doCodeLens: (uri: string) => Promise<_.CodeLens[]>;
|
|
34
|
+
doCodeLensResolve: (item: _.CodeLens) => Promise<_.CodeLens>;
|
|
35
|
+
findDocumentHighlights: (uri: string, position: _.Position) => Promise<_.DocumentHighlight[] | undefined>;
|
|
36
|
+
findDocumentLinks: (uri: string) => Promise<_.DocumentLink[]>;
|
|
37
|
+
findWorkspaceSymbols: (query: string) => Promise<_.SymbolInformation[]>;
|
|
38
|
+
doAutoInsert: (uri: string, position: _.Position, autoInsertContext: {
|
|
40
39
|
lastChange: {
|
|
41
|
-
range:
|
|
40
|
+
range: _.Range;
|
|
42
41
|
rangeOffset: number;
|
|
43
42
|
rangeLength: number;
|
|
44
43
|
text: string;
|
|
45
44
|
};
|
|
46
|
-
}) => Promise<NonNullable<string |
|
|
47
|
-
doExecuteCommand: (command: string, args: executeCommand.ExecutePluginCommandArgs, executeCommandContext: import("./
|
|
48
|
-
getInlayHints: (uri: string, range:
|
|
45
|
+
}) => Promise<NonNullable<string | _.TextEdit | null | undefined> | undefined>;
|
|
46
|
+
doExecuteCommand: (command: string, args: executeCommand.ExecutePluginCommandArgs, executeCommandContext: import("./types").ExecuteCommandContext) => Promise<void>;
|
|
47
|
+
getInlayHints: (uri: string, range: _.Range) => Promise<_.InlayHint[] | undefined>;
|
|
49
48
|
callHierarchy: {
|
|
50
|
-
doPrepare(uri: string, position:
|
|
51
|
-
getIncomingCalls(item:
|
|
52
|
-
getOutgoingCalls(item:
|
|
49
|
+
doPrepare(uri: string, position: _.Position): Promise<_.CallHierarchyItem[] | undefined>;
|
|
50
|
+
getIncomingCalls(item: _.CallHierarchyItem): Promise<_.CallHierarchyIncomingCall[]>;
|
|
51
|
+
getOutgoingCalls(item: _.CallHierarchyItem): Promise<_.CallHierarchyOutgoingCall[]>;
|
|
53
52
|
};
|
|
54
53
|
dispose: () => void;
|
|
55
|
-
context:
|
|
54
|
+
context: LanguageServiceRuntimeContext;
|
|
56
55
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.createLanguageService = exports.createLanguageServiceContext = void 0;
|
|
3
|
+
const shared = require("@volar/shared");
|
|
4
|
+
const tsFaster = require("@volar/typescript-faster");
|
|
5
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
|
+
const documents_1 = require("./documents");
|
|
3
7
|
const autoInsert = require("./languageFeatures/autoInsert");
|
|
4
8
|
const callHierarchy = require("./languageFeatures/callHierarchy");
|
|
5
9
|
const codeActionResolve = require("./languageFeatures/codeActionResolve");
|
|
@@ -23,10 +27,6 @@ const renamePrepare = require("./languageFeatures/renamePrepare");
|
|
|
23
27
|
const signatureHelp = require("./languageFeatures/signatureHelp");
|
|
24
28
|
const diagnostics = require("./languageFeatures/validation");
|
|
25
29
|
const workspaceSymbol = require("./languageFeatures/workspaceSymbols");
|
|
26
|
-
const tsFaster = require("@volar/typescript-faster");
|
|
27
|
-
const shared = require("@volar/shared");
|
|
28
|
-
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
29
|
-
const documents_1 = require("./documents");
|
|
30
30
|
function createLanguageServiceContext(options) {
|
|
31
31
|
const ts = options.host.getTypeScriptModule();
|
|
32
32
|
const tsLs = ts.createLanguageService(options.context.typescriptLanguageServiceHost, options.documentRegistry);
|
package/out/documents.d.ts
CHANGED
|
@@ -16,15 +16,15 @@ export declare class SourceMap<Data = undefined> extends SourceMapBase<Data> {
|
|
|
16
16
|
toSourceRanges(range: vscode.Range, filter?: (data: Data) => boolean): Generator<vscode.Range, void, unknown>;
|
|
17
17
|
toGeneratedRanges(range: vscode.Range, filter?: (data: Data) => boolean): Generator<vscode.Range, void, unknown>;
|
|
18
18
|
protected toRanges(range: vscode.Range, filter: (data: Data) => boolean, api: 'toSourcePositionsBase' | 'toGeneratedPositionsBase', api2: 'matchSourcePosition' | 'matchGeneratedPosition'): Generator<vscode.Range, void, unknown>;
|
|
19
|
-
toSourcePosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared.
|
|
20
|
-
toGeneratedPosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared.
|
|
21
|
-
toSourcePositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared.
|
|
22
|
-
toGeneratedPositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared.
|
|
23
|
-
toSourcePositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared.
|
|
24
|
-
toGeneratedPositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared.
|
|
25
|
-
protected toPositions(position: vscode.Position, filter: (data: Data) => boolean, fromDoc: TextDocument, toDoc: TextDocument, from: 'sourceRange' | 'generatedRange', to: 'sourceRange' | 'generatedRange', baseOffset: 'left' | 'right'): Generator<readonly [shared.
|
|
26
|
-
protected matchSourcePosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared.
|
|
27
|
-
protected matchGeneratedPosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared.
|
|
19
|
+
toSourcePosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared._1.Position | undefined;
|
|
20
|
+
toGeneratedPosition(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): shared._1.Position | undefined;
|
|
21
|
+
toSourcePositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared._1.Position, void, unknown>;
|
|
22
|
+
toGeneratedPositions(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<shared._1.Position, void, unknown>;
|
|
23
|
+
toSourcePositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared._1.Position, Mapping<Data>], void, unknown>;
|
|
24
|
+
toGeneratedPositionsBase(position: vscode.Position, filter?: (data: Data) => boolean, baseOffset?: 'left' | 'right'): Generator<readonly [shared._1.Position, Mapping<Data>], void, unknown>;
|
|
25
|
+
protected toPositions(position: vscode.Position, filter: (data: Data) => boolean, fromDoc: TextDocument, toDoc: TextDocument, from: 'sourceRange' | 'generatedRange', to: 'sourceRange' | 'generatedRange', baseOffset: 'left' | 'right'): Generator<readonly [shared._1.Position, Mapping<Data>], void, unknown>;
|
|
26
|
+
protected matchSourcePosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared._1.Position | undefined;
|
|
27
|
+
protected matchGeneratedPosition(position: vscode.Position, mapping: Mapping, baseOffset: 'left' | 'right'): shared._1.Position | undefined;
|
|
28
28
|
}
|
|
29
29
|
export declare class EmbeddedDocumentSourceMap extends SourceMap<PositionCapabilities> {
|
|
30
30
|
embeddedFile: EmbeddedFile;
|
|
@@ -36,35 +36,35 @@ export declare class TeleportSourceMap extends SourceMap<TeleportMappingData> {
|
|
|
36
36
|
embeddedFile: EmbeddedFile;
|
|
37
37
|
document: TextDocument;
|
|
38
38
|
constructor(embeddedFile: EmbeddedFile, document: TextDocument, mappings: Mapping<TeleportMappingData>[]);
|
|
39
|
-
findTeleports(start: vscode.Position): Generator<readonly [shared.
|
|
39
|
+
findTeleports(start: vscode.Position): Generator<readonly [shared._1.Position, import("@volar/language-core").TeleportCapabilities], void, unknown>;
|
|
40
40
|
}
|
|
41
41
|
export declare function parseSourceFileDocuments(rootUri: URI, mapper: DocumentRegistry): {
|
|
42
42
|
getAll: () => {
|
|
43
43
|
uri: string;
|
|
44
44
|
file: SourceFile;
|
|
45
45
|
getSourceMap: (embedded: EmbeddedFile) => EmbeddedDocumentSourceMap;
|
|
46
|
-
getEmbeddedDocument: (embeddedFile: SourceFile) => shared.
|
|
46
|
+
getEmbeddedDocument: (embeddedFile: SourceFile) => shared._1.TextDocument;
|
|
47
47
|
getSourceMaps: () => EmbeddedDocumentSourceMap[];
|
|
48
48
|
getTeleports: () => TeleportSourceMap[];
|
|
49
|
-
getDocument: () => shared.
|
|
49
|
+
getDocument: () => shared._1.TextDocument;
|
|
50
50
|
}[];
|
|
51
51
|
get: (uri: string) => {
|
|
52
52
|
uri: string;
|
|
53
53
|
file: SourceFile;
|
|
54
54
|
getSourceMap: (embedded: EmbeddedFile) => EmbeddedDocumentSourceMap;
|
|
55
|
-
getEmbeddedDocument: (embeddedFile: SourceFile) => shared.
|
|
55
|
+
getEmbeddedDocument: (embeddedFile: SourceFile) => shared._1.TextDocument;
|
|
56
56
|
getSourceMaps: () => EmbeddedDocumentSourceMap[];
|
|
57
57
|
getTeleports: () => TeleportSourceMap[];
|
|
58
|
-
getDocument: () => shared.
|
|
58
|
+
getDocument: () => shared._1.TextDocument;
|
|
59
59
|
} | undefined;
|
|
60
60
|
fromEmbeddedDocument: (document: TextDocument) => {
|
|
61
61
|
uri: string;
|
|
62
62
|
file: SourceFile;
|
|
63
63
|
getSourceMap: (embedded: EmbeddedFile) => EmbeddedDocumentSourceMap;
|
|
64
|
-
getEmbeddedDocument: (embeddedFile: SourceFile) => shared.
|
|
64
|
+
getEmbeddedDocument: (embeddedFile: SourceFile) => shared._1.TextDocument;
|
|
65
65
|
getSourceMaps: () => EmbeddedDocumentSourceMap[];
|
|
66
66
|
getTeleports: () => TeleportSourceMap[];
|
|
67
|
-
getDocument: () => shared.
|
|
67
|
+
getDocument: () => shared._1.TextDocument;
|
|
68
68
|
} | undefined;
|
|
69
69
|
sourceMapFromEmbeddedDocumentUri: (uri: string) => EmbeddedDocumentSourceMap | undefined;
|
|
70
70
|
teleportfromEmbeddedDocumentUri: (uri: string) => TeleportSourceMap | undefined;
|
|
@@ -73,8 +73,8 @@ export declare function parseSourceFileDocument(rootUri: URI, sourceFile: Source
|
|
|
73
73
|
uri: string;
|
|
74
74
|
file: SourceFile;
|
|
75
75
|
getSourceMap: (embedded: EmbeddedFile) => EmbeddedDocumentSourceMap;
|
|
76
|
-
getEmbeddedDocument: (embeddedFile: SourceFile) => shared.
|
|
76
|
+
getEmbeddedDocument: (embeddedFile: SourceFile) => shared._1.TextDocument;
|
|
77
77
|
getSourceMaps: () => EmbeddedDocumentSourceMap[];
|
|
78
78
|
getTeleports: () => TeleportSourceMap[];
|
|
79
|
-
getDocument: () => shared.
|
|
79
|
+
getDocument: () => shared._1.TextDocument;
|
|
80
80
|
};
|
package/out/index.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export * from './baseLanguageService';
|
|
|
4
4
|
export * from './documents';
|
|
5
5
|
export { executePluginCommand, ExecutePluginCommandArgs } from './languageFeatures/executeCommand';
|
|
6
6
|
export { mergeWorkspaceEdits } from './languageFeatures/rename';
|
|
7
|
-
export * from './plugin';
|
|
8
7
|
export * from './types';
|
package/out/index.js
CHANGED
|
@@ -22,6 +22,5 @@ var executeCommand_1 = require("./languageFeatures/executeCommand");
|
|
|
22
22
|
Object.defineProperty(exports, "executePluginCommand", { enumerable: true, get: function () { return executeCommand_1.executePluginCommand; } });
|
|
23
23
|
var rename_1 = require("./languageFeatures/rename");
|
|
24
24
|
Object.defineProperty(exports, "mergeWorkspaceEdits", { enumerable: true, get: function () { return rename_1.mergeWorkspaceEdits; } });
|
|
25
|
-
__exportStar(require("./plugin"), exports);
|
|
26
25
|
__exportStar(require("./types"), exports);
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.register = void 0;
|
|
12
12
|
const shared = require("@volar/shared");
|
|
13
|
-
const
|
|
13
|
+
const path_1 = require("path");
|
|
14
14
|
const dedupe = require("../utils/dedupe");
|
|
15
15
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
16
16
|
function register(context) {
|
|
@@ -134,7 +134,7 @@ function register(context) {
|
|
|
134
134
|
if (!selectionRange)
|
|
135
135
|
return;
|
|
136
136
|
const vueRanges = tsRanges.map(tsRange => sourceMap.toSourceRange(tsRange)).filter(shared.notEmpty);
|
|
137
|
-
const vueItem = Object.assign(Object.assign({}, tsItem), { name: tsItem.name ===
|
|
137
|
+
const vueItem = Object.assign(Object.assign({}, tsItem), { name: tsItem.name === path_1.posix.basename(shared.getPathOfUri(sourceMap.mappedDocument.uri)) ? path_1.posix.basename(shared.getPathOfUri(sourceMap.sourceDocument.uri)) : tsItem.name, uri: sourceMap.sourceDocument.uri,
|
|
138
138
|
// TS Bug: `range: range` not works
|
|
139
139
|
range: {
|
|
140
140
|
start: range.start,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import { SemanticToken } from '@volar/language-service';
|
|
3
3
|
import type { LanguageServiceRuntimeContext } from '../types';
|
|
4
|
-
export declare function register(context: LanguageServiceRuntimeContext): (uri: string, range
|
|
4
|
+
export declare function register(context: LanguageServiceRuntimeContext): (uri: string, range: vscode.Range | undefined, cancleToken: vscode.CancellationToken, reportProgress?: ((tokens: SemanticToken[]) => void) | undefined) => Promise<SemanticToken[] | undefined> | undefined;
|
|
@@ -20,8 +20,6 @@ function register(context) {
|
|
|
20
20
|
return;
|
|
21
21
|
let range;
|
|
22
22
|
for (const mapping of sourceMap.mappings) {
|
|
23
|
-
if (cancleToken === null || cancleToken === void 0 ? void 0 : cancleToken.isCancellationRequested)
|
|
24
|
-
return;
|
|
25
23
|
if (mapping.data.semanticTokens
|
|
26
24
|
&& mapping.sourceRange[1] > offsetRange[0]
|
|
27
25
|
&& mapping.sourceRange[0] < offsetRange[1]) {
|
|
@@ -39,7 +37,7 @@ function register(context) {
|
|
|
39
37
|
}
|
|
40
38
|
}, (plugin, document, offsetRange) => {
|
|
41
39
|
var _a;
|
|
42
|
-
return (_a = plugin.findDocumentSemanticTokens) === null || _a === void 0 ? void 0 : _a.call(plugin, document, vscode.Range.create(document.positionAt(offsetRange[0]), document.positionAt(offsetRange[1]))
|
|
40
|
+
return (_a = plugin.findDocumentSemanticTokens) === null || _a === void 0 ? void 0 : _a.call(plugin, document, vscode.Range.create(document.positionAt(offsetRange[0]), document.positionAt(offsetRange[1])));
|
|
43
41
|
}, (tokens, sourceMap) => tokens.map(_token => {
|
|
44
42
|
if (!sourceMap)
|
|
45
43
|
return _token;
|
|
@@ -4,4 +4,4 @@ export declare function updateRange(range: vscode.Range, change: {
|
|
|
4
4
|
range: vscode.Range;
|
|
5
5
|
newEnd: vscode.Position;
|
|
6
6
|
}): vscode.Range;
|
|
7
|
-
export declare function register(context: LanguageServiceRuntimeContext): (uri: string, response?: ((result: vscode.Diagnostic[]) => void) | undefined
|
|
7
|
+
export declare function register(context: LanguageServiceRuntimeContext): (uri: string, token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
|
|
@@ -13,12 +13,6 @@ const shared = require("@volar/shared");
|
|
|
13
13
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
14
14
|
const dedupe = require("../utils/dedupe");
|
|
15
15
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
16
|
-
function isTsDocument(document) {
|
|
17
|
-
return document.languageId === 'javascript' ||
|
|
18
|
-
document.languageId === 'typescript' ||
|
|
19
|
-
document.languageId === 'javascriptreact' ||
|
|
20
|
-
document.languageId === 'typescriptreact';
|
|
21
|
-
}
|
|
22
16
|
function updateRange(range, change) {
|
|
23
17
|
updatePosition(range.start, change, false);
|
|
24
18
|
updatePosition(range.end, change, true);
|
|
@@ -86,7 +80,7 @@ function register(context) {
|
|
|
86
80
|
const scriptTsCache_declaration = new Map();
|
|
87
81
|
const scriptTsCache_syntactic = new Map();
|
|
88
82
|
const scriptTsCache_suggestion = new Map();
|
|
89
|
-
return (uri,
|
|
83
|
+
return (uri, token, response) => __awaiter(this, void 0, void 0, function* () {
|
|
90
84
|
var _a;
|
|
91
85
|
const cache = (_a = responseCache.get(uri)) !== null && _a !== void 0 ? _a : responseCache.set(uri, {
|
|
92
86
|
nonTs: { snapshot: undefined, errors: [] },
|
|
@@ -117,15 +111,13 @@ function register(context) {
|
|
|
117
111
|
}
|
|
118
112
|
let shouldSend = false;
|
|
119
113
|
let lastCheckCancelAt = 0;
|
|
120
|
-
yield worker(
|
|
121
|
-
doResponse();
|
|
122
|
-
yield worker(1 /* EmbeddedFileKind.TypeScriptHostFile */, 'onSyntactic', scriptTsCache_syntactic, cache.tsSyntactic);
|
|
114
|
+
yield worker('onSyntactic', scriptTsCache_syntactic, cache.tsSyntactic);
|
|
123
115
|
doResponse();
|
|
124
|
-
yield worker(
|
|
116
|
+
yield worker('onSuggestion', scriptTsCache_suggestion, cache.tsSuggestion);
|
|
125
117
|
doResponse();
|
|
126
|
-
yield worker(
|
|
118
|
+
yield worker('onSemantic', scriptTsCache_semantic, cache.tsSemantic);
|
|
127
119
|
doResponse();
|
|
128
|
-
yield worker(
|
|
120
|
+
yield worker('onDeclaration', scriptTsCache_declaration, cache.tsDeclaration);
|
|
129
121
|
return getErrors();
|
|
130
122
|
function doResponse() {
|
|
131
123
|
if (shouldSend) {
|
|
@@ -136,44 +128,34 @@ function register(context) {
|
|
|
136
128
|
function getErrors() {
|
|
137
129
|
return Object.values(cache).flatMap(({ errors }) => errors);
|
|
138
130
|
}
|
|
139
|
-
function worker(
|
|
131
|
+
function worker(mode, cacheMap, cache) {
|
|
140
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
133
|
const result = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, true, function* (arg, sourceMap) {
|
|
142
|
-
if (sourceMap.embeddedFile.capabilities.diagnostic
|
|
134
|
+
if (sourceMap.embeddedFile.capabilities.diagnostic) {
|
|
143
135
|
yield arg;
|
|
144
136
|
}
|
|
145
137
|
}, (plugin, document, arg, sourceMap) => __awaiter(this, void 0, void 0, function* () {
|
|
146
138
|
var _a, _b, _c, _d, _e;
|
|
147
|
-
if (
|
|
139
|
+
if (token) {
|
|
148
140
|
if (Date.now() - lastCheckCancelAt >= 5) {
|
|
149
141
|
yield shared.sleep(5); // wait for LSP event polling
|
|
150
142
|
lastCheckCancelAt = Date.now();
|
|
151
143
|
}
|
|
152
|
-
if (
|
|
144
|
+
if (token.isCancellationRequested)
|
|
153
145
|
return;
|
|
154
146
|
}
|
|
155
|
-
// avoid duplicate errors from vue plugin & typescript plugin
|
|
156
|
-
if (isTsDocument(document) !== (kind === 1 /* EmbeddedFileKind.TypeScriptHostFile */))
|
|
157
|
-
return;
|
|
158
147
|
const pluginId = context.plugins.indexOf(plugin);
|
|
159
148
|
const pluginCache = (_a = cacheMap.get(pluginId)) !== null && _a !== void 0 ? _a : cacheMap.set(pluginId, new Map()).get(pluginId);
|
|
160
149
|
const cache = pluginCache.get(document.uri);
|
|
161
|
-
const tsProjectVersion =
|
|
162
|
-
if (
|
|
163
|
-
if (cache && cache.documentVersion === document.version) {
|
|
150
|
+
const tsProjectVersion = (mode === 'onDeclaration' || mode === 'onSemantic') ? (_c = (_b = context.core.typescriptLanguageServiceHost).getProjectVersion) === null || _c === void 0 ? void 0 : _c.call(_b) : undefined;
|
|
151
|
+
if (mode === 'onDeclaration' || mode === 'onSemantic') {
|
|
152
|
+
if (cache && cache.documentVersion === document.version && cache.tsProjectVersion === tsProjectVersion) {
|
|
164
153
|
return cache.errors;
|
|
165
154
|
}
|
|
166
155
|
}
|
|
167
156
|
else {
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
return cache.errors;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
if (cache && cache.documentVersion === document.version) {
|
|
175
|
-
return cache.errors;
|
|
176
|
-
}
|
|
157
|
+
if (cache && cache.documentVersion === document.version) {
|
|
158
|
+
return cache.errors;
|
|
177
159
|
}
|
|
178
160
|
}
|
|
179
161
|
const errors = yield ((_e = (_d = plugin.validation) === null || _d === void 0 ? void 0 : _d[mode]) === null || _e === void 0 ? void 0 : _e.call(_d, document));
|
package/out/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LanguageServicePlugin } from '@volar/language-service';
|
|
2
1
|
import { EmbeddedLanguageModule, LanguageServiceHost, EmbeddedLanguageContext, SourceFile } from '@volar/language-core';
|
|
3
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
4
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
@@ -6,6 +5,7 @@ import { SourceFileDocument, SourceFileDocuments } from './documents';
|
|
|
6
5
|
import type { DocumentContext, FileSystemProvider } from 'vscode-html-languageservice';
|
|
7
6
|
import type { SchemaRequestService } from 'vscode-json-languageservice';
|
|
8
7
|
import { URI } from 'vscode-uri';
|
|
8
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
9
9
|
export interface DocumentServiceRuntimeContext {
|
|
10
10
|
typescript: typeof import('typescript/lib/tsserverlibrary');
|
|
11
11
|
plugins: LanguageServicePlugin[];
|
|
@@ -41,3 +41,95 @@ export interface ConfigurationHost {
|
|
|
41
41
|
getConfiguration: (<T>(section: string, scopeUri?: string) => Promise<T | undefined>);
|
|
42
42
|
onDidChangeConfiguration: (cb: () => void) => void;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* LanguageServicePlugin
|
|
46
|
+
*/
|
|
47
|
+
export type NotNullableResult<T> = T | Thenable<T>;
|
|
48
|
+
export type NullableResult<T> = NotNullableResult<T | undefined | null>;
|
|
49
|
+
export type SemanticToken = [number, number, number, number, number];
|
|
50
|
+
export interface ExecuteCommandContext {
|
|
51
|
+
token: vscode.CancellationToken;
|
|
52
|
+
workDoneProgress: {
|
|
53
|
+
begin(title: string, percentage?: number, message?: string, cancellable?: boolean): void;
|
|
54
|
+
report(percentage: number): void;
|
|
55
|
+
report(message: string): void;
|
|
56
|
+
report(percentage: number, message: string): void;
|
|
57
|
+
done(): void;
|
|
58
|
+
};
|
|
59
|
+
showReferences(params: {
|
|
60
|
+
textDocument: vscode.TextDocumentIdentifier;
|
|
61
|
+
position: vscode.Position;
|
|
62
|
+
references: vscode.Location[];
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
applyEdit(paramOrEdit: vscode.ApplyWorkspaceEditParams | vscode.WorkspaceEdit): Promise<vscode.ApplyWorkspaceEditResult>;
|
|
65
|
+
}
|
|
66
|
+
export interface LanguageServicePlugin {
|
|
67
|
+
setup?(context: LanguageServicePluginContext): void;
|
|
68
|
+
validation?: {
|
|
69
|
+
onSemantic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
70
|
+
onSyntactic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
71
|
+
onSuggestion?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
72
|
+
onDeclaration?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
73
|
+
};
|
|
74
|
+
doHover?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Hover>;
|
|
75
|
+
findImplementations?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
76
|
+
findReferences?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Location[]>;
|
|
77
|
+
findFileReferences?(document: TextDocument): NullableResult<vscode.Location[]>;
|
|
78
|
+
findDocumentHighlights?(document: TextDocument, position: vscode.Position): NullableResult<vscode.DocumentHighlight[]>;
|
|
79
|
+
findDocumentLinks?(document: TextDocument): NullableResult<vscode.DocumentLink[]>;
|
|
80
|
+
findDocumentSymbols?(document: TextDocument): NullableResult<vscode.SymbolInformation[]>;
|
|
81
|
+
findDocumentSemanticTokens?(document: TextDocument, range: vscode.Range): NullableResult<SemanticToken[]>;
|
|
82
|
+
findWorkspaceSymbols?(query: string): NullableResult<vscode.SymbolInformation[]>;
|
|
83
|
+
doExecuteCommand?(command: string, args: any[], context: ExecuteCommandContext): NotNullableResult<void>;
|
|
84
|
+
findDocumentColors?(document: TextDocument): NullableResult<vscode.ColorInformation[]>;
|
|
85
|
+
getColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range): NullableResult<vscode.ColorPresentation[]>;
|
|
86
|
+
doFileRename?(oldUri: string, newUri: string): NullableResult<vscode.WorkspaceEdit>;
|
|
87
|
+
getFoldingRanges?(document: TextDocument): NullableResult<vscode.FoldingRange[]>;
|
|
88
|
+
getSelectionRanges?(document: TextDocument, positions: vscode.Position[]): NullableResult<vscode.SelectionRange[]>;
|
|
89
|
+
getSignatureHelp?(document: TextDocument, position: vscode.Position, context?: vscode.SignatureHelpContext): NullableResult<vscode.SignatureHelp>;
|
|
90
|
+
format?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
91
|
+
formatOnType?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
92
|
+
definition?: {
|
|
93
|
+
on?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
94
|
+
onType?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
95
|
+
};
|
|
96
|
+
complete?: {
|
|
97
|
+
triggerCharacters?: string[];
|
|
98
|
+
isAdditional?: boolean;
|
|
99
|
+
on?(document: TextDocument, position: vscode.Position, context?: vscode.CompletionContext): NullableResult<vscode.CompletionList>;
|
|
100
|
+
resolve?(item: vscode.CompletionItem): NotNullableResult<vscode.CompletionItem>;
|
|
101
|
+
};
|
|
102
|
+
rename?: {
|
|
103
|
+
prepare?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
104
|
+
on?(document: TextDocument, position: vscode.Position, newName: string): NullableResult<vscode.WorkspaceEdit>;
|
|
105
|
+
};
|
|
106
|
+
codeAction?: {
|
|
107
|
+
on?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext): NullableResult<vscode.CodeAction[]>;
|
|
108
|
+
resolve?(codeAction: vscode.CodeAction): NotNullableResult<vscode.CodeAction>;
|
|
109
|
+
};
|
|
110
|
+
codeLens?: {
|
|
111
|
+
on?(document: TextDocument): NullableResult<vscode.CodeLens[]>;
|
|
112
|
+
resolve?(codeLens: vscode.CodeLens): NotNullableResult<vscode.CodeLens>;
|
|
113
|
+
};
|
|
114
|
+
callHierarchy?: {
|
|
115
|
+
prepare(document: TextDocument, position: vscode.Position): NullableResult<vscode.CallHierarchyItem[]>;
|
|
116
|
+
onIncomingCalls(item: vscode.CallHierarchyItem): NotNullableResult<vscode.CallHierarchyIncomingCall[]>;
|
|
117
|
+
onOutgoingCalls(item: vscode.CallHierarchyItem): NotNullableResult<vscode.CallHierarchyOutgoingCall[]>;
|
|
118
|
+
};
|
|
119
|
+
inlayHints?: {
|
|
120
|
+
on?(document: TextDocument, range: vscode.Range): NullableResult<vscode.InlayHint[]>;
|
|
121
|
+
};
|
|
122
|
+
findLinkedEditingRanges?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LinkedEditingRanges>;
|
|
123
|
+
doAutoInsert?(document: TextDocument, position: vscode.Position, context: {
|
|
124
|
+
lastChange: {
|
|
125
|
+
range: vscode.Range;
|
|
126
|
+
rangeOffset: number;
|
|
127
|
+
rangeLength: number;
|
|
128
|
+
text: string;
|
|
129
|
+
};
|
|
130
|
+
}): NullableResult<string | vscode.TextEdit>;
|
|
131
|
+
/**
|
|
132
|
+
* TODO: only support to doCompleteResolve for now
|
|
133
|
+
*/
|
|
134
|
+
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
135
|
+
}
|
package/out/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -16,18 +16,17 @@
|
|
|
16
16
|
"typescript": "beta"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/language-core": "1.0.0-beta.
|
|
20
|
-
"@volar/shared": "1.0.0-beta.
|
|
21
|
-
"@volar/source-map": "1.0.0-beta.
|
|
22
|
-
"@volar/transforms": "1.0.0-beta.
|
|
23
|
-
"@volar/typescript-faster": "1.0.0-beta.
|
|
19
|
+
"@volar/language-core": "1.0.0-beta.3",
|
|
20
|
+
"@volar/shared": "1.0.0-beta.3",
|
|
21
|
+
"@volar/source-map": "1.0.0-beta.3",
|
|
22
|
+
"@volar/transforms": "1.0.0-beta.3",
|
|
23
|
+
"@volar/typescript-faster": "1.0.0-beta.3",
|
|
24
24
|
"@vue/reactivity": "^3.2.38",
|
|
25
|
-
"upath": "^2.0.1",
|
|
26
25
|
"vscode-html-languageservice": "^5.0.1",
|
|
27
26
|
"vscode-json-languageservice": "^5.1.0",
|
|
28
27
|
"vscode-languageserver-protocol": "^3.17.2",
|
|
29
28
|
"vscode-languageserver-textdocument": "^1.0.7",
|
|
30
29
|
"vscode-uri": "^3.0.3"
|
|
31
30
|
},
|
|
32
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "b7242f995970b4eedfcf068619497eb845e9ac73"
|
|
33
32
|
}
|
package/out/plugin.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import { LanguageServicePluginContext } from './types';
|
|
4
|
-
export type NotNullableResult<T> = T | Thenable<T>;
|
|
5
|
-
export type NullableResult<T> = NotNullableResult<T | undefined | null>;
|
|
6
|
-
export type SemanticToken = [number, number, number, number, number];
|
|
7
|
-
export interface ExecuteCommandContext {
|
|
8
|
-
token: vscode.CancellationToken;
|
|
9
|
-
workDoneProgress: {
|
|
10
|
-
begin(title: string, percentage?: number, message?: string, cancellable?: boolean): void;
|
|
11
|
-
report(percentage: number): void;
|
|
12
|
-
report(message: string): void;
|
|
13
|
-
report(percentage: number, message: string): void;
|
|
14
|
-
done(): void;
|
|
15
|
-
};
|
|
16
|
-
showReferences(params: {
|
|
17
|
-
textDocument: vscode.TextDocumentIdentifier;
|
|
18
|
-
position: vscode.Position;
|
|
19
|
-
references: vscode.Location[];
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
applyEdit(paramOrEdit: vscode.ApplyWorkspaceEditParams | vscode.WorkspaceEdit): Promise<vscode.ApplyWorkspaceEditResult>;
|
|
22
|
-
}
|
|
23
|
-
export interface LanguageServicePlugin {
|
|
24
|
-
setup?(context: LanguageServicePluginContext): void;
|
|
25
|
-
validation?: {
|
|
26
|
-
onFull?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
27
|
-
onSemantic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
28
|
-
onSyntactic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
29
|
-
onSuggestion?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
30
|
-
onDeclaration?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
31
|
-
};
|
|
32
|
-
doHover?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Hover>;
|
|
33
|
-
findImplementations?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
34
|
-
findReferences?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Location[]>;
|
|
35
|
-
findFileReferences?(document: TextDocument): NullableResult<vscode.Location[]>;
|
|
36
|
-
findDocumentHighlights?(document: TextDocument, position: vscode.Position): NullableResult<vscode.DocumentHighlight[]>;
|
|
37
|
-
findDocumentLinks?(document: TextDocument): NullableResult<vscode.DocumentLink[]>;
|
|
38
|
-
findDocumentSymbols?(document: TextDocument): NullableResult<vscode.SymbolInformation[]>;
|
|
39
|
-
findDocumentSemanticTokens?(document: TextDocument, range?: vscode.Range, cancleToken?: vscode.CancellationToken): NullableResult<SemanticToken[]>;
|
|
40
|
-
findWorkspaceSymbols?(query: string): NullableResult<vscode.SymbolInformation[]>;
|
|
41
|
-
doExecuteCommand?(command: string, args: any[], context: ExecuteCommandContext): NotNullableResult<void>;
|
|
42
|
-
findDocumentColors?(document: TextDocument): NullableResult<vscode.ColorInformation[]>;
|
|
43
|
-
getColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range): NullableResult<vscode.ColorPresentation[]>;
|
|
44
|
-
doFileRename?(oldUri: string, newUri: string): NullableResult<vscode.WorkspaceEdit>;
|
|
45
|
-
getFoldingRanges?(document: TextDocument): NullableResult<vscode.FoldingRange[]>;
|
|
46
|
-
getSelectionRanges?(document: TextDocument, positions: vscode.Position[]): NullableResult<vscode.SelectionRange[]>;
|
|
47
|
-
getSignatureHelp?(document: TextDocument, position: vscode.Position, context?: vscode.SignatureHelpContext): NullableResult<vscode.SignatureHelp>;
|
|
48
|
-
format?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
49
|
-
formatOnType?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
50
|
-
definition?: {
|
|
51
|
-
on?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
52
|
-
onType?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
53
|
-
};
|
|
54
|
-
complete?: {
|
|
55
|
-
triggerCharacters?: string[];
|
|
56
|
-
isAdditional?: boolean;
|
|
57
|
-
on?(document: TextDocument, position: vscode.Position, context?: vscode.CompletionContext): NullableResult<vscode.CompletionList>;
|
|
58
|
-
resolve?(item: vscode.CompletionItem): NotNullableResult<vscode.CompletionItem>;
|
|
59
|
-
};
|
|
60
|
-
rename?: {
|
|
61
|
-
prepare?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
62
|
-
on?(document: TextDocument, position: vscode.Position, newName: string): NullableResult<vscode.WorkspaceEdit>;
|
|
63
|
-
};
|
|
64
|
-
codeAction?: {
|
|
65
|
-
on?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext): NullableResult<vscode.CodeAction[]>;
|
|
66
|
-
resolve?(codeAction: vscode.CodeAction): NotNullableResult<vscode.CodeAction>;
|
|
67
|
-
};
|
|
68
|
-
codeLens?: {
|
|
69
|
-
on?(document: TextDocument): NullableResult<vscode.CodeLens[]>;
|
|
70
|
-
resolve?(codeLens: vscode.CodeLens): NotNullableResult<vscode.CodeLens>;
|
|
71
|
-
};
|
|
72
|
-
callHierarchy?: {
|
|
73
|
-
prepare(document: TextDocument, position: vscode.Position): NullableResult<vscode.CallHierarchyItem[]>;
|
|
74
|
-
onIncomingCalls(item: vscode.CallHierarchyItem): NotNullableResult<vscode.CallHierarchyIncomingCall[]>;
|
|
75
|
-
onOutgoingCalls(item: vscode.CallHierarchyItem): NotNullableResult<vscode.CallHierarchyOutgoingCall[]>;
|
|
76
|
-
};
|
|
77
|
-
inlayHints?: {
|
|
78
|
-
on?(document: TextDocument, range: vscode.Range): NullableResult<vscode.InlayHint[]>;
|
|
79
|
-
};
|
|
80
|
-
findLinkedEditingRanges?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LinkedEditingRanges>;
|
|
81
|
-
doAutoInsert?(document: TextDocument, position: vscode.Position, context: {
|
|
82
|
-
lastChange: {
|
|
83
|
-
range: vscode.Range;
|
|
84
|
-
rangeOffset: number;
|
|
85
|
-
rangeLength: number;
|
|
86
|
-
text: string;
|
|
87
|
-
};
|
|
88
|
-
}): NullableResult<string | vscode.TextEdit>;
|
|
89
|
-
/**
|
|
90
|
-
* TODO: only support to doCompleteResolve for now
|
|
91
|
-
*/
|
|
92
|
-
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
93
|
-
}
|
package/out/plugin.js
DELETED