@volar/language-service 1.4.1 → 1.5.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/out/baseLanguageService.d.ts +8 -5
- package/out/baseLanguageService.js +72 -61
- package/out/documentFeatures/colorPresentations.d.ts +2 -2
- package/out/documentFeatures/documentColors.d.ts +2 -2
- package/out/documentFeatures/documentSymbols.d.ts +2 -2
- package/out/documentFeatures/foldingRanges.d.ts +2 -2
- package/out/documentFeatures/format.d.ts +2 -2
- package/out/documentFeatures/format.js +6 -6
- package/out/documentFeatures/linkedEditingRanges.d.ts +2 -2
- package/out/documentFeatures/selectionRanges.d.ts +2 -2
- package/out/documents.d.ts +3 -3
- package/out/documents.js +10 -10
- package/out/languageFeatures/autoInsert.d.ts +2 -2
- package/out/languageFeatures/callHierarchy.d.ts +2 -2
- package/out/languageFeatures/callHierarchy.js +1 -1
- package/out/languageFeatures/codeActionResolve.d.ts +2 -2
- package/out/languageFeatures/codeActions.d.ts +2 -2
- package/out/languageFeatures/codeLens.d.ts +2 -2
- package/out/languageFeatures/codeLensResolve.d.ts +2 -2
- package/out/languageFeatures/codeLensResolve.js +1 -1
- package/out/languageFeatures/complete.d.ts +2 -2
- package/out/languageFeatures/completeResolve.d.ts +2 -2
- package/out/languageFeatures/definition.d.ts +2 -2
- package/out/languageFeatures/documentHighlights.d.ts +2 -2
- package/out/languageFeatures/documentLinkResolve.d.ts +2 -2
- package/out/languageFeatures/documentLinks.d.ts +2 -2
- package/out/languageFeatures/documentSemanticTokens.d.ts +2 -2
- package/out/languageFeatures/fileReferences.d.ts +2 -2
- package/out/languageFeatures/fileRename.d.ts +2 -2
- package/out/languageFeatures/hover.d.ts +2 -2
- package/out/languageFeatures/inlayHintResolve.d.ts +2 -2
- package/out/languageFeatures/inlayHints.d.ts +2 -2
- package/out/languageFeatures/references.d.ts +2 -2
- package/out/languageFeatures/rename.d.ts +2 -2
- package/out/languageFeatures/renamePrepare.d.ts +2 -2
- package/out/languageFeatures/signatureHelp.d.ts +2 -2
- package/out/languageFeatures/validation.d.ts +2 -2
- package/out/languageFeatures/validation.js +2 -2
- package/out/languageFeatures/workspaceSymbols.d.ts +2 -2
- package/out/types.d.ts +76 -111
- package/out/utils/featureWorkers.d.ts +4 -4
- package/out/utils/featureWorkers.js +2 -18
- package/package.json +4 -4
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageServiceHost } from '@volar/language-core';
|
|
2
|
+
import { Config, ServiceContext, ServiceEnvironment } from './types';
|
|
2
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
4
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
4
5
|
export type LanguageService = ReturnType<typeof createLanguageServiceBase>;
|
|
5
|
-
export declare function createLanguageService(
|
|
6
|
+
export declare function createLanguageService(modules: {
|
|
7
|
+
typescript?: typeof import('typescript/lib/tsserverlibrary');
|
|
8
|
+
}, env: ServiceEnvironment, config: Config, host: LanguageServiceHost, documentRegistry?: ts.DocumentRegistry): {
|
|
6
9
|
triggerCharacters: string[];
|
|
7
10
|
autoFormatTriggerCharacters: string[];
|
|
8
11
|
signatureHelpTriggerCharacters: string[];
|
|
@@ -48,9 +51,9 @@ export declare function createLanguageService(ctx: LanguageServiceOptions, docum
|
|
|
48
51
|
getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
49
52
|
};
|
|
50
53
|
dispose: () => void | undefined;
|
|
51
|
-
context:
|
|
54
|
+
context: ServiceContext;
|
|
52
55
|
};
|
|
53
|
-
declare function createLanguageServiceBase(context:
|
|
56
|
+
declare function createLanguageServiceBase(context: ServiceContext): {
|
|
54
57
|
triggerCharacters: string[];
|
|
55
58
|
autoFormatTriggerCharacters: string[];
|
|
56
59
|
signatureHelpTriggerCharacters: string[];
|
|
@@ -96,6 +99,6 @@ declare function createLanguageServiceBase(context: LanguageServicePluginContext
|
|
|
96
99
|
getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
97
100
|
};
|
|
98
101
|
dispose: () => void | undefined;
|
|
99
|
-
context:
|
|
102
|
+
context: ServiceContext;
|
|
100
103
|
};
|
|
101
104
|
export {};
|
|
@@ -39,106 +39,117 @@ const selectionRanges = require("./documentFeatures/selectionRanges");
|
|
|
39
39
|
const vscode = require("vscode-languageserver-protocol");
|
|
40
40
|
// fix build
|
|
41
41
|
const common_1 = require("./utils/common");
|
|
42
|
-
function createLanguageService(
|
|
43
|
-
const languageContext = (0, language_core_1.createLanguageContext)(
|
|
44
|
-
const context = createLanguageServicePluginContext(
|
|
42
|
+
function createLanguageService(modules, env, config, host, documentRegistry) {
|
|
43
|
+
const languageContext = (0, language_core_1.createLanguageContext)(modules, host, Object.values(config.languages ?? {}).filter(common_1.notEmpty));
|
|
44
|
+
const context = createLanguageServicePluginContext(modules, env, config, host, languageContext, documentRegistry);
|
|
45
45
|
return createLanguageServiceBase(context);
|
|
46
46
|
}
|
|
47
47
|
exports.createLanguageService = createLanguageService;
|
|
48
|
-
function createLanguageServicePluginContext(
|
|
49
|
-
const ts =
|
|
48
|
+
function createLanguageServicePluginContext(modules, env, config, host, languageContext, documentRegistry) {
|
|
49
|
+
const ts = modules.typescript;
|
|
50
50
|
let tsLs;
|
|
51
51
|
if (ts) {
|
|
52
|
-
const created = tsFaster.createLanguageService(ts, languageContext.typescript.languageServiceHost, proxiedHost => ts.createLanguageService(proxiedHost, documentRegistry),
|
|
52
|
+
const created = tsFaster.createLanguageService(ts, languageContext.typescript.languageServiceHost, proxiedHost => ts.createLanguageService(proxiedHost, documentRegistry), env.rootUri.path);
|
|
53
53
|
tsLs = created.languageService;
|
|
54
|
-
if (created.setPreferences &&
|
|
55
|
-
const configHost = ctx.configurationHost;
|
|
54
|
+
if (created.setPreferences && env.getConfiguration) {
|
|
56
55
|
updatePreferences();
|
|
57
|
-
|
|
56
|
+
env.onDidChangeConfiguration?.(updatePreferences);
|
|
58
57
|
async function updatePreferences() {
|
|
59
|
-
const preferences = await
|
|
58
|
+
const preferences = await env.getConfiguration?.('typescript.preferences');
|
|
60
59
|
if (preferences) {
|
|
61
60
|
created.setPreferences?.(preferences);
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
if (created.projectUpdated) {
|
|
66
|
-
let scriptFileNames = new Set(
|
|
67
|
-
|
|
65
|
+
let scriptFileNames = new Set(host.getScriptFileNames());
|
|
66
|
+
env.onDidChangeWatchedFiles?.((params) => {
|
|
68
67
|
if (params.changes.some(change => change.type !== vscode.FileChangeType.Changed)) {
|
|
69
|
-
scriptFileNames = new Set(
|
|
68
|
+
scriptFileNames = new Set(host.getScriptFileNames());
|
|
70
69
|
}
|
|
71
70
|
for (const change of params.changes) {
|
|
72
|
-
if (scriptFileNames.has(
|
|
73
|
-
created.projectUpdated?.(
|
|
71
|
+
if (scriptFileNames.has(env.uriToFileName(change.uri))) {
|
|
72
|
+
created.projectUpdated?.(env.uriToFileName(env.rootUri.fsPath));
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
|
-
const textDocumentMapper = (0, documents_1.createDocumentsAndSourceMaps)(
|
|
78
|
+
const textDocumentMapper = (0, documents_1.createDocumentsAndSourceMaps)(env, host, languageContext.virtualFiles);
|
|
80
79
|
const documents = new WeakMap();
|
|
81
80
|
const documentVersions = new Map();
|
|
82
81
|
const context = {
|
|
83
|
-
|
|
82
|
+
env,
|
|
83
|
+
config,
|
|
84
|
+
host,
|
|
84
85
|
core: languageContext,
|
|
85
86
|
plugins: {},
|
|
86
87
|
typescript: ts && tsLs ? {
|
|
87
|
-
module: ts,
|
|
88
88
|
languageServiceHost: languageContext.typescript.languageServiceHost,
|
|
89
89
|
languageService: tsLs,
|
|
90
90
|
} : undefined,
|
|
91
91
|
documents: textDocumentMapper,
|
|
92
92
|
commands: {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
rename: {
|
|
94
|
+
create(uri, position) {
|
|
95
|
+
const source = toSourceLocation(uri, position, data => typeof data.rename === 'object' ? !!data.rename.normalize : !!data.rename);
|
|
96
|
+
if (!source) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
return vscode.Command.create('', 'editor.action.rename', source.uri, source.position);
|
|
100
|
+
},
|
|
101
|
+
is(command) {
|
|
102
|
+
return command.command === 'editor.action.rename';
|
|
103
|
+
},
|
|
99
104
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
showReferences: {
|
|
106
|
+
create(uri, position, locations) {
|
|
107
|
+
const source = toSourceLocation(uri, position);
|
|
108
|
+
if (!source) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const sourceReferences = [];
|
|
112
|
+
for (const reference of locations) {
|
|
113
|
+
if (context.documents.isVirtualFileUri(reference.uri)) {
|
|
114
|
+
for (const [_, map] of context.documents.getMapsByVirtualFileUri(reference.uri)) {
|
|
115
|
+
const range = map.toSourceRange(reference.range);
|
|
116
|
+
if (range) {
|
|
117
|
+
sourceReferences.push({ uri: map.sourceFileDocument.uri, range });
|
|
118
|
+
}
|
|
112
119
|
}
|
|
113
120
|
}
|
|
121
|
+
else {
|
|
122
|
+
sourceReferences.push(reference);
|
|
123
|
+
}
|
|
114
124
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
return vscode.Command.create(locations.length === 1 ? '1 reference' : `${locations.length} references`, 'editor.action.showReferences', source.uri, source.position, sourceReferences);
|
|
126
|
+
},
|
|
127
|
+
is(command) {
|
|
128
|
+
return command.command === 'editor.action.showReferences';
|
|
129
|
+
},
|
|
120
130
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
setSelection: {
|
|
132
|
+
create(position) {
|
|
133
|
+
return vscode.Command.create('', 'setSelection', {
|
|
134
|
+
selection: {
|
|
135
|
+
selectionStartLineNumber: position.line + 1,
|
|
136
|
+
positionLineNumber: position.line + 1,
|
|
137
|
+
selectionStartColumn: position.character + 1,
|
|
138
|
+
positionColumn: position.character + 1,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
is(command) {
|
|
143
|
+
return command.command === 'setSelection';
|
|
144
|
+
}
|
|
130
145
|
},
|
|
131
146
|
},
|
|
132
147
|
getTextDocument,
|
|
133
148
|
};
|
|
134
|
-
for (const
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
context.plugins[pluginId] = _plugin;
|
|
139
|
-
}
|
|
140
|
-
else if (plugin) {
|
|
141
|
-
context.plugins[pluginId] = plugin;
|
|
149
|
+
for (const serviceId in config.services ?? {}) {
|
|
150
|
+
const service = config.services?.[serviceId];
|
|
151
|
+
if (service) {
|
|
152
|
+
context.plugins[serviceId] = service(context, modules);
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
return context;
|
|
@@ -160,14 +171,14 @@ function createLanguageServicePluginContext(ctx, languageContext, documentRegist
|
|
|
160
171
|
}
|
|
161
172
|
}
|
|
162
173
|
function getTextDocument(uri) {
|
|
163
|
-
const fileName =
|
|
164
|
-
const scriptSnapshot =
|
|
174
|
+
const fileName = env.uriToFileName(uri);
|
|
175
|
+
const scriptSnapshot = host.getScriptSnapshot(fileName);
|
|
165
176
|
if (scriptSnapshot) {
|
|
166
177
|
let document = documents.get(scriptSnapshot);
|
|
167
178
|
if (!document) {
|
|
168
179
|
const newVersion = (documentVersions.get(uri.toLowerCase()) ?? 0) + 1;
|
|
169
180
|
documentVersions.set(uri.toLowerCase(), newVersion);
|
|
170
|
-
document = vscode_languageserver_textdocument_1.TextDocument.create(uri,
|
|
181
|
+
document = vscode_languageserver_textdocument_1.TextDocument.create(uri, host.getScriptLanguageId?.(fileName) ?? (0, common_1.resolveCommonLanguageId)(uri), newVersion, scriptSnapshot.getText(0, scriptSnapshot.getLength()));
|
|
171
182
|
documents.set(scriptSnapshot, document);
|
|
172
183
|
}
|
|
173
184
|
return document;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.FoldingRange[] | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
4
4
|
ch: string;
|
|
5
5
|
position: vscode.Position;
|
|
6
6
|
} | undefined, token?: vscode.CancellationToken) => Promise<vscode.TextEdit[] | undefined>;
|
|
@@ -16,7 +16,7 @@ function register(context) {
|
|
|
16
16
|
? (await tryFormat(document, onTypeParams.position, onTypeParams.ch))?.edits
|
|
17
17
|
: (await tryFormat(document, range, undefined))?.edits;
|
|
18
18
|
}
|
|
19
|
-
const initialIndentLanguageId = await context.
|
|
19
|
+
const initialIndentLanguageId = await context.env.getConfiguration?.('volar.format.initialIndent') ?? { html: true };
|
|
20
20
|
const originalSnapshot = source.snapshot;
|
|
21
21
|
const rootVirtualFile = source.root;
|
|
22
22
|
const originalDocument = document;
|
|
@@ -56,7 +56,7 @@ function register(context) {
|
|
|
56
56
|
toPatchIndentUris.push({
|
|
57
57
|
uri: map.virtualFileDocument.uri,
|
|
58
58
|
isCodeBlock,
|
|
59
|
-
|
|
59
|
+
service: embeddedCodeResult.plugin,
|
|
60
60
|
});
|
|
61
61
|
for (const textEdit of embeddedCodeResult.edits) {
|
|
62
62
|
const range = map.toSourceRange(textEdit.range);
|
|
@@ -72,7 +72,7 @@ function register(context) {
|
|
|
72
72
|
if (edits.length > 0) {
|
|
73
73
|
const newText = vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, edits);
|
|
74
74
|
document = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version + 1, newText);
|
|
75
|
-
context.core.virtualFiles.updateSource(context.uriToFileName(document.uri), (0, common_1.stringToSnapshot)(document.getText()), undefined);
|
|
75
|
+
context.core.virtualFiles.updateSource(context.env.uriToFileName(document.uri), (0, common_1.stringToSnapshot)(document.getText()), undefined);
|
|
76
76
|
edited = true;
|
|
77
77
|
}
|
|
78
78
|
if (level > 1) {
|
|
@@ -88,7 +88,7 @@ function register(context) {
|
|
|
88
88
|
for (const toPatchIndentUri of toPatchIndentUris) {
|
|
89
89
|
for (const [_, map] of context.documents.getMapsByVirtualFileUri(toPatchIndentUri.uri)) {
|
|
90
90
|
const indentSensitiveLines = new Set();
|
|
91
|
-
for (const plugin of toPatchIndentUri.
|
|
91
|
+
for (const plugin of toPatchIndentUri.service.provideFormattingIndentSensitiveLines ? [toPatchIndentUri.service] : Object.values(context.plugins)) {
|
|
92
92
|
if (token.isCancellationRequested)
|
|
93
93
|
break;
|
|
94
94
|
if (plugin.provideFormattingIndentSensitiveLines) {
|
|
@@ -121,7 +121,7 @@ function register(context) {
|
|
|
121
121
|
if (indentEdits.length > 0) {
|
|
122
122
|
const newText = vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, indentEdits);
|
|
123
123
|
document = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version + 1, newText);
|
|
124
|
-
context.core.virtualFiles.updateSource(context.uriToFileName(document.uri), (0, common_1.stringToSnapshot)(document.getText()), undefined);
|
|
124
|
+
context.core.virtualFiles.updateSource(context.env.uriToFileName(document.uri), (0, common_1.stringToSnapshot)(document.getText()), undefined);
|
|
125
125
|
edited = true;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -130,7 +130,7 @@ function register(context) {
|
|
|
130
130
|
}
|
|
131
131
|
if (edited) {
|
|
132
132
|
// recover
|
|
133
|
-
context.core.virtualFiles.updateSource(context.uriToFileName(document.uri), originalSnapshot, undefined);
|
|
133
|
+
context.core.virtualFiles.updateSource(context.env.uriToFileName(document.uri), originalSnapshot, undefined);
|
|
134
134
|
}
|
|
135
135
|
if (document.getText() === originalDocument.getText())
|
|
136
136
|
return;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
package/out/documents.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { VirtualFiles, VirtualFile, FileRangeCapabilities, MirrorBehaviorCapabilities, MirrorMap } from '@volar/language-core';
|
|
1
|
+
import { VirtualFiles, VirtualFile, FileRangeCapabilities, MirrorBehaviorCapabilities, MirrorMap, LanguageServiceHost } from '@volar/language-core';
|
|
2
2
|
import { Mapping, SourceMap } from '@volar/source-map';
|
|
3
3
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
4
4
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
5
5
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
6
|
-
import {
|
|
6
|
+
import { ServiceEnvironment } from './types';
|
|
7
7
|
export type DocumentsAndSourceMaps = ReturnType<typeof createDocumentsAndSourceMaps>;
|
|
8
8
|
export declare class SourceMapWithDocuments<Data = any> {
|
|
9
9
|
sourceFileDocument: TextDocument;
|
|
@@ -30,7 +30,7 @@ export declare class MirrorMapWithDocument extends SourceMapWithDocuments<[Mirro
|
|
|
30
30
|
constructor(document: TextDocument, map: MirrorMap);
|
|
31
31
|
findMirrorPositions(start: vscode.Position): Generator<readonly [import("vscode-languageserver-textdocument").Position, MirrorBehaviorCapabilities], void, unknown>;
|
|
32
32
|
}
|
|
33
|
-
export declare function createDocumentsAndSourceMaps(
|
|
33
|
+
export declare function createDocumentsAndSourceMaps(env: ServiceEnvironment, host: LanguageServiceHost, mapper: VirtualFiles): {
|
|
34
34
|
getSourceByUri(sourceFileUri: string): import("@volar/language-core").Source | undefined;
|
|
35
35
|
isVirtualFileUri(virtualFileUri: string): boolean;
|
|
36
36
|
getVirtualFileByUri(virtualFileUri: string): readonly [VirtualFile, import("@volar/language-core").Source] | readonly [undefined, undefined];
|
package/out/documents.js
CHANGED
|
@@ -130,23 +130,23 @@ class MirrorMapWithDocument extends SourceMapWithDocuments {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
exports.MirrorMapWithDocument = MirrorMapWithDocument;
|
|
133
|
-
function createDocumentsAndSourceMaps(
|
|
133
|
+
function createDocumentsAndSourceMaps(env, host, mapper) {
|
|
134
134
|
let version = 0;
|
|
135
135
|
const _maps = new WeakMap();
|
|
136
136
|
const _mirrorMaps = new WeakMap();
|
|
137
137
|
const _documents = new WeakMap();
|
|
138
138
|
return {
|
|
139
139
|
getSourceByUri(sourceFileUri) {
|
|
140
|
-
return mapper.getSource(
|
|
140
|
+
return mapper.getSource(env.uriToFileName(sourceFileUri));
|
|
141
141
|
},
|
|
142
142
|
isVirtualFileUri(virtualFileUri) {
|
|
143
|
-
return mapper.hasVirtualFile(
|
|
143
|
+
return mapper.hasVirtualFile(env.uriToFileName(virtualFileUri));
|
|
144
144
|
},
|
|
145
145
|
getVirtualFileByUri(virtualFileUri) {
|
|
146
|
-
return mapper.getVirtualFile(
|
|
146
|
+
return mapper.getVirtualFile(env.uriToFileName(virtualFileUri));
|
|
147
147
|
},
|
|
148
148
|
getMirrorMapByUri(virtualFileUri) {
|
|
149
|
-
const fileName =
|
|
149
|
+
const fileName = env.uriToFileName(virtualFileUri);
|
|
150
150
|
const [virtualFile] = mapper.getVirtualFile(fileName);
|
|
151
151
|
if (virtualFile) {
|
|
152
152
|
const map = mapper.getMirrorMap(virtualFile);
|
|
@@ -159,7 +159,7 @@ function createDocumentsAndSourceMaps(ctx, mapper) {
|
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
getMapsBySourceFileUri(uri) {
|
|
162
|
-
return this.getMapsBySourceFileName(
|
|
162
|
+
return this.getMapsBySourceFileName(env.uriToFileName(uri));
|
|
163
163
|
},
|
|
164
164
|
getMapsBySourceFileName(fileName) {
|
|
165
165
|
const source = mapper.getSource(fileName);
|
|
@@ -187,7 +187,7 @@ function createDocumentsAndSourceMaps(ctx, mapper) {
|
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
getMapsByVirtualFileUri(virtualFileUri) {
|
|
190
|
-
return this.getMapsByVirtualFileName(
|
|
190
|
+
return this.getMapsByVirtualFileName(env.uriToFileName(virtualFileUri));
|
|
191
191
|
},
|
|
192
192
|
*getMapsByVirtualFileName(virtualFileName) {
|
|
193
193
|
const [virtualFile] = mapper.getVirtualFile(virtualFileName);
|
|
@@ -206,7 +206,7 @@ function createDocumentsAndSourceMaps(ctx, mapper) {
|
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
getDocumentByUri(snapshot, uri) {
|
|
209
|
-
return this.getDocumentByFileName(snapshot,
|
|
209
|
+
return this.getDocumentByFileName(snapshot, env.uriToFileName(uri));
|
|
210
210
|
},
|
|
211
211
|
getDocumentByFileName,
|
|
212
212
|
};
|
|
@@ -216,8 +216,8 @@ function createDocumentsAndSourceMaps(ctx, mapper) {
|
|
|
216
216
|
}
|
|
217
217
|
const map = _documents.get(snapshot);
|
|
218
218
|
if (!map.has(fileName)) {
|
|
219
|
-
const uri =
|
|
220
|
-
map.set(fileName, vscode_languageserver_textdocument_1.TextDocument.create(uri,
|
|
219
|
+
const uri = env.fileNameToUri(fileName);
|
|
220
|
+
map.set(fileName, vscode_languageserver_textdocument_1.TextDocument.create(uri, host.getScriptLanguageId?.(fileName) ?? (0, common_1.resolveCommonLanguageId)(uri), version++, snapshot.getText(0, snapshot.getLength())));
|
|
221
221
|
}
|
|
222
222
|
return map.get(fileName);
|
|
223
223
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext, AutoInsertionContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, autoInsertContext: AutoInsertionContext, token?: vscode.CancellationToken) => Promise<NonNullable<string | vscode.TextEdit | null | undefined> | undefined>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export interface PluginCallHierarchyData {
|
|
4
4
|
uri: string;
|
|
5
5
|
original: Pick<vscode.CallHierarchyItem, 'data'>;
|
|
6
6
|
pluginId: string;
|
|
7
7
|
virtualDocumentUri: string | undefined;
|
|
8
8
|
}
|
|
9
|
-
export declare function register(context:
|
|
9
|
+
export declare function register(context: ServiceContext): {
|
|
10
10
|
doPrepare(uri: string, position: vscode.Position, token?: vscode.CancellationToken): Promise<vscode.CallHierarchyItem[] | undefined>;
|
|
11
11
|
getIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[]>;
|
|
12
12
|
getOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[]>;
|
|
@@ -121,7 +121,7 @@ function register(context) {
|
|
|
121
121
|
const vueRanges = tsRanges.map(tsRange => map.toSourceRange(tsRange)).filter(common_1.notEmpty);
|
|
122
122
|
const vueItem = {
|
|
123
123
|
...tsItem,
|
|
124
|
-
name: tsItem.name === path_1.posix.basename(context.uriToFileName(map.virtualFileDocument.uri)) ? path_1.posix.basename(context.uriToFileName(map.sourceFileDocument.uri)) : tsItem.name,
|
|
124
|
+
name: tsItem.name === path_1.posix.basename(context.env.uriToFileName(map.virtualFileDocument.uri)) ? path_1.posix.basename(context.env.uriToFileName(map.sourceFileDocument.uri)) : tsItem.name,
|
|
125
125
|
uri: map.sourceFileDocument.uri,
|
|
126
126
|
// TS Bug: `range: range` not works
|
|
127
127
|
range: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export interface PluginCodeActionData {
|
|
4
4
|
uri: string;
|
|
5
5
|
version: number;
|
|
@@ -17,4 +17,4 @@ export interface RuleCodeActionData {
|
|
|
17
17
|
ruleFixIndex: number;
|
|
18
18
|
index: number;
|
|
19
19
|
}
|
|
20
|
-
export declare function register(context:
|
|
20
|
+
export declare function register(context: ServiceContext): (uri: string, range: vscode.Range, codeActionContext: vscode.CodeActionContext, token?: vscode.CancellationToken) => Promise<vscode.CodeAction[] | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export interface PluginCodeLensData {
|
|
4
4
|
kind: 'normal';
|
|
@@ -12,4 +12,4 @@ export interface PluginReferencesCodeLensData {
|
|
|
12
12
|
range: vscode.Range;
|
|
13
13
|
pluginId: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function register(context:
|
|
15
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
@@ -22,7 +22,7 @@ function register(context) {
|
|
|
22
22
|
if (document && plugin.resolveReferencesCodeLensLocations) {
|
|
23
23
|
references = await plugin.resolveReferencesCodeLensLocations(document, data.range, references, token);
|
|
24
24
|
}
|
|
25
|
-
item.command = context.commands.
|
|
25
|
+
item.command = context.commands.showReferences.create(data.uri, data.range.start, references);
|
|
26
26
|
}
|
|
27
27
|
return item;
|
|
28
28
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export interface PluginCompletionData {
|
|
4
4
|
uri: string;
|
|
5
5
|
original: Pick<vscode.CompletionItem, 'additionalTextEdits' | 'textEdit' | 'data'>;
|
|
6
6
|
pluginId: string;
|
|
7
7
|
virtualDocumentUri: string | undefined;
|
|
8
8
|
}
|
|
9
|
-
export declare function register(context:
|
|
9
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
import { FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
|
|
4
|
-
export declare function register(context:
|
|
4
|
+
export declare function register(context: ServiceContext, apiName: 'provideDefinition' | 'provideTypeDefinition' | 'provideImplementation', isValidMapping: (data: FileRangeCapabilities) => boolean, isValidMirrorPosition: (mirrorData: MirrorBehaviorCapabilities) => boolean): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export interface DocumentLinkData {
|
|
4
4
|
uri: string;
|
|
5
5
|
original: Pick<vscode.DocumentLink, 'data'>;
|
|
6
6
|
pluginId: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function register(context:
|
|
8
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, token?: vscode.CancellationToken, reportProgress?: ((tokens: vscode.SemanticTokens) => void) | undefined) => Promise<vscode.SemanticTokens | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
import { NullableResult } from '@volar/language-service';
|
|
4
|
-
export declare function register(context:
|
|
4
|
+
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => NullableResult<vscode.Location[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceContext } from '../types';
|
|
2
2
|
import type * as _ from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
3
|
+
export declare function register(context: ServiceContext): (oldUri: string, newUri: string, token?: _.CancellationToken) => Promise<_.WorkspaceEdit | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export interface InlayHintData {
|
|
4
4
|
uri: string;
|
|
5
5
|
original: Pick<vscode.CodeAction, 'data' | 'edit'>;
|
|
6
6
|
pluginId: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function register(context:
|
|
8
|
+
export declare function register(context: ServiceContext): (uri: string, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
import { DocumentsAndSourceMaps } from '../documents';
|
|
4
|
-
export declare function register(context:
|
|
4
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
5
5
|
export declare function mergeWorkspaceEdits(original: vscode.WorkspaceEdit, ...others: vscode.WorkspaceEdit[]): void;
|
|
6
6
|
export declare function embeddedEditToSourceEdit(tsResult: vscode.WorkspaceEdit, documents: DocumentsAndSourceMaps, mode: 'fileName' | 'rename' | 'codeAction' | 'format', versions?: Record<string, number>): vscode.WorkspaceEdit | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<NonNullable<vscode.Range | vscode.ResponseError<void> | null | undefined> | undefined>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function updateRange(range: vscode.Range, change: {
|
|
4
4
|
range: vscode.Range;
|
|
5
5
|
newEnd: vscode.Position;
|
|
@@ -18,4 +18,4 @@ export declare const errorMarkups: Record<string, {
|
|
|
18
18
|
error: vscode.Diagnostic;
|
|
19
19
|
markup: vscode.MarkupContent;
|
|
20
20
|
}[]>;
|
|
21
|
-
export declare function register(context:
|
|
21
|
+
export declare function register(context: ServiceContext): (uri: string, mode: 'all' | 'semantic' | 'syntactic', token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
|
|
@@ -99,7 +99,7 @@ function register(context) {
|
|
|
99
99
|
syntax_rules: { errors: [] },
|
|
100
100
|
format_rules: { errors: [] },
|
|
101
101
|
}).get(uri);
|
|
102
|
-
const newSnapshot = context.host.getScriptSnapshot(context.uriToFileName(uri));
|
|
102
|
+
const newSnapshot = context.host.getScriptSnapshot(context.env.uriToFileName(uri));
|
|
103
103
|
let updateCacheRangeFailed = false;
|
|
104
104
|
let errorsUpdated = false;
|
|
105
105
|
let lastCheckCancelAt = 0;
|
|
@@ -130,7 +130,7 @@ function register(context) {
|
|
|
130
130
|
await doResponse();
|
|
131
131
|
await lintWorker('onSyntax', cacheMaps.syntax_rules, lastResponse.syntax_rules);
|
|
132
132
|
await doResponse();
|
|
133
|
-
await worker('
|
|
133
|
+
await worker('provideDiagnostics', cacheMaps.syntactic, lastResponse.syntactic);
|
|
134
134
|
await doResponse();
|
|
135
135
|
}
|
|
136
136
|
if (mode === 'all' || mode === 'semantic') {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { ServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: ServiceContext): (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
package/out/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageContext,
|
|
1
|
+
import { LanguageContext, Language, LanguageServiceHost } from '@volar/language-core';
|
|
2
2
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
3
|
import type { DocumentContext, FileSystemProvider } from 'vscode-html-languageservice';
|
|
4
4
|
import type { SchemaRequestService } from 'vscode-json-languageservice';
|
|
@@ -7,45 +7,43 @@ import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
|
7
7
|
import { URI } from 'vscode-uri';
|
|
8
8
|
import { DocumentsAndSourceMaps } from './documents';
|
|
9
9
|
export * from 'vscode-languageserver-protocol';
|
|
10
|
-
export interface
|
|
11
|
-
modules: {
|
|
12
|
-
typescript?: typeof import('typescript/lib/tsserverlibrary');
|
|
13
|
-
};
|
|
10
|
+
export interface ServiceEnvironment {
|
|
14
11
|
locale?: string;
|
|
15
12
|
rootUri: URI;
|
|
16
|
-
|
|
17
|
-
host: LanguageServiceHost;
|
|
18
|
-
config: Config;
|
|
13
|
+
clientCapabilities?: vscode.ClientCapabilities;
|
|
19
14
|
uriToFileName(uri: string): string;
|
|
20
15
|
fileNameToUri(fileName: string): string;
|
|
21
|
-
|
|
16
|
+
getConfiguration?<T>(section: string, scopeUri?: string): Promise<T | undefined>;
|
|
17
|
+
onDidChangeConfiguration?(cb: () => void): void;
|
|
18
|
+
onDidChangeWatchedFiles?(cb: (params: vscode.DidChangeWatchedFilesParams) => void): () => void;
|
|
22
19
|
documentContext?: DocumentContext;
|
|
23
20
|
fileSystemProvider?: FileSystemProvider;
|
|
24
|
-
fileSystemHost?: FileSystemHost;
|
|
25
21
|
schemaRequestService?: SchemaRequestService;
|
|
26
22
|
}
|
|
27
|
-
interface
|
|
28
|
-
|
|
23
|
+
interface Command<T> {
|
|
24
|
+
create: T;
|
|
25
|
+
is(value: vscode.Command): boolean;
|
|
29
26
|
}
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
export interface LanguageServicePluginContext extends LanguageServiceOptions {
|
|
27
|
+
export interface ServiceContext {
|
|
28
|
+
env: ServiceEnvironment;
|
|
29
|
+
config: Config;
|
|
30
|
+
host: LanguageServiceHost;
|
|
36
31
|
typescript: {
|
|
37
|
-
module: typeof import('typescript/lib/tsserverlibrary');
|
|
38
32
|
languageServiceHost: ts.LanguageServiceHost;
|
|
39
33
|
languageService: ts.LanguageService;
|
|
40
34
|
} | undefined;
|
|
41
|
-
commands:
|
|
35
|
+
commands: {
|
|
36
|
+
showReferences: Command<(uri: string, position: vscode.Position, locations: vscode.Location[]) => vscode.Command | undefined>;
|
|
37
|
+
rename: Command<(uri: string, position: vscode.Position) => vscode.Command | undefined>;
|
|
38
|
+
setSelection: Command<(position: vscode.Position) => vscode.Command | undefined>;
|
|
39
|
+
};
|
|
42
40
|
/** @private */
|
|
43
41
|
core: LanguageContext;
|
|
44
42
|
/** @private */
|
|
45
43
|
documents: DocumentsAndSourceMaps;
|
|
46
44
|
/** @private */
|
|
47
45
|
plugins: {
|
|
48
|
-
[id: string]:
|
|
46
|
+
[id: string]: ReturnType<Service>;
|
|
49
47
|
};
|
|
50
48
|
/** @private */
|
|
51
49
|
getTextDocument(uri: string): TextDocument | undefined;
|
|
@@ -58,18 +56,62 @@ export interface LanguageServicePluginContext extends LanguageServiceOptions {
|
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
|
-
export interface ConfigurationHost {
|
|
62
|
-
getConfiguration: (<T>(section: string, scopeUri?: string) => Promise<T | undefined>);
|
|
63
|
-
onDidChangeConfiguration: (cb: () => void) => void;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* LanguageServicePlugin
|
|
67
|
-
*/
|
|
68
59
|
export type Result<T> = T | Thenable<T>;
|
|
69
60
|
export type NullableResult<T> = Result<T | undefined | null>;
|
|
70
61
|
export type SemanticToken = [number, number, number, number, number];
|
|
71
|
-
export interface
|
|
72
|
-
(context
|
|
62
|
+
export interface Service {
|
|
63
|
+
(context: ServiceContext | undefined, modules: {
|
|
64
|
+
typescript?: typeof import('typescript/lib/tsserverlibrary');
|
|
65
|
+
} | undefined): {
|
|
66
|
+
isAdditionalCompletion?: boolean;
|
|
67
|
+
triggerCharacters?: string[];
|
|
68
|
+
signatureHelpTriggerCharacters?: string[];
|
|
69
|
+
signatureHelpRetriggerCharacters?: string[];
|
|
70
|
+
autoFormatTriggerCharacters?: string[];
|
|
71
|
+
provideHover?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Hover>;
|
|
72
|
+
provideDocumentSymbols?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentSymbol[]>;
|
|
73
|
+
provideDocumentHighlights?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.DocumentHighlight[]>;
|
|
74
|
+
provideLinkedEditingRanges?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LinkedEditingRanges>;
|
|
75
|
+
provideDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
76
|
+
provideTypeDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
77
|
+
provideImplementation?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
78
|
+
provideCodeLenses?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.CodeLens[]>;
|
|
79
|
+
provideCodeActions?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken): NullableResult<vscode.CodeAction[]>;
|
|
80
|
+
provideDocumentFormattingEdits?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
81
|
+
provideOnTypeFormattingEdits?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
82
|
+
provideDocumentLinks?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentLink[]>;
|
|
83
|
+
provideCompletionItems?(document: TextDocument, position: vscode.Position, context: vscode.CompletionContext, token: vscode.CancellationToken): NullableResult<vscode.CompletionList>;
|
|
84
|
+
provideDocumentColors?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.ColorInformation[]>;
|
|
85
|
+
provideColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.ColorPresentation[]>;
|
|
86
|
+
provideFoldingRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.FoldingRange[]>;
|
|
87
|
+
provideSignatureHelp?(document: TextDocument, position: vscode.Position, context: vscode.SignatureHelpContext, token: vscode.CancellationToken): NullableResult<vscode.SignatureHelp>;
|
|
88
|
+
provideRenameRange?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
89
|
+
provideRenameEdits?(document: TextDocument, position: vscode.Position, newName: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
90
|
+
provideReferences?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
91
|
+
provideSelectionRanges?(document: TextDocument, positions: vscode.Position[], token: vscode.CancellationToken): NullableResult<vscode.SelectionRange[]>;
|
|
92
|
+
provideInlayHints?(document: TextDocument, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.InlayHint[]>;
|
|
93
|
+
provideCallHierarchyItems?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.CallHierarchyItem[]>;
|
|
94
|
+
provideCallHierarchyIncomingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyIncomingCall[]>;
|
|
95
|
+
provideCallHierarchyOutgoingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyOutgoingCall[]>;
|
|
96
|
+
provideDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend, token: vscode.CancellationToken): NullableResult<SemanticToken[]>;
|
|
97
|
+
provideWorkspaceSymbols?(query: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceSymbol[]>;
|
|
98
|
+
provideDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
99
|
+
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
100
|
+
provideDiagnosticMarkupContent?(diagnostic: vscode.Diagnostic, token: vscode.CancellationToken): NullableResult<vscode.MarkupContent>;
|
|
101
|
+
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
102
|
+
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Range[]>;
|
|
103
|
+
provideAutoInsertionEdit?(document: TextDocument, position: vscode.Position, context: AutoInsertionContext, token: vscode.CancellationToken): NullableResult<string | vscode.TextEdit>;
|
|
104
|
+
provideFileRenameEdits?(oldUri: string, newUri: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
105
|
+
provideFormattingIndentSensitiveLines?(document: TextDocument, token: vscode.CancellationToken): NullableResult<number[]>;
|
|
106
|
+
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Result<vscode.CodeLens>;
|
|
107
|
+
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): Result<vscode.CodeAction>;
|
|
108
|
+
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): Result<vscode.CompletionItem>;
|
|
109
|
+
resolveDocumentLink?(link: vscode.DocumentLink, token: vscode.CancellationToken): Result<vscode.DocumentLink>;
|
|
110
|
+
resolveInlayHint?(inlayHint: vscode.InlayHint, token: vscode.CancellationToken): Result<vscode.InlayHint>;
|
|
111
|
+
resolveReferencesCodeLensLocations?(document: TextDocument, range: vscode.Range, references: vscode.Location[], token: vscode.CancellationToken): Result<vscode.Location[]>;
|
|
112
|
+
resolveRuleContext?(context: RuleContext, ruleType: 'format' | 'syntax' | 'semantic'): Result<RuleContext>;
|
|
113
|
+
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
114
|
+
};
|
|
73
115
|
}
|
|
74
116
|
export interface AutoInsertionContext {
|
|
75
117
|
lastChange: {
|
|
@@ -79,90 +121,13 @@ export interface AutoInsertionContext {
|
|
|
79
121
|
text: string;
|
|
80
122
|
};
|
|
81
123
|
}
|
|
82
|
-
export interface LanguageServicePluginInstance {
|
|
83
|
-
isAdditionalCompletion?: boolean;
|
|
84
|
-
triggerCharacters?: string[];
|
|
85
|
-
signatureHelpTriggerCharacters?: string[];
|
|
86
|
-
signatureHelpRetriggerCharacters?: string[];
|
|
87
|
-
autoFormatTriggerCharacters?: string[];
|
|
88
|
-
provideHover?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Hover>;
|
|
89
|
-
provideDocumentSymbols?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentSymbol[]>;
|
|
90
|
-
provideDocumentHighlights?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.DocumentHighlight[]>;
|
|
91
|
-
provideLinkedEditingRanges?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LinkedEditingRanges>;
|
|
92
|
-
provideDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
93
|
-
provideTypeDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
94
|
-
provideImplementation?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
95
|
-
provideCodeLenses?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.CodeLens[]>;
|
|
96
|
-
provideCodeActions?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken): NullableResult<vscode.CodeAction[]>;
|
|
97
|
-
provideDocumentFormattingEdits?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
98
|
-
provideOnTypeFormattingEdits?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
99
|
-
provideDocumentLinks?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentLink[]>;
|
|
100
|
-
provideCompletionItems?(document: TextDocument, position: vscode.Position, context: vscode.CompletionContext, token: vscode.CancellationToken): NullableResult<vscode.CompletionList>;
|
|
101
|
-
provideDocumentColors?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.ColorInformation[]>;
|
|
102
|
-
provideColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.ColorPresentation[]>;
|
|
103
|
-
provideFoldingRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.FoldingRange[]>;
|
|
104
|
-
provideSignatureHelp?(document: TextDocument, position: vscode.Position, context: vscode.SignatureHelpContext, token: vscode.CancellationToken): NullableResult<vscode.SignatureHelp>;
|
|
105
|
-
provideRenameRange?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
106
|
-
provideRenameEdits?(document: TextDocument, position: vscode.Position, newName: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
107
|
-
provideReferences?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
108
|
-
provideSelectionRanges?(document: TextDocument, positions: vscode.Position[], token: vscode.CancellationToken): NullableResult<vscode.SelectionRange[]>;
|
|
109
|
-
provideInlayHints?(document: TextDocument, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.InlayHint[]>;
|
|
110
|
-
provideCallHierarchyItems?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.CallHierarchyItem[]>;
|
|
111
|
-
provideCallHierarchyIncomingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyIncomingCall[]>;
|
|
112
|
-
provideCallHierarchyOutgoingCalls?(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyOutgoingCall[]>;
|
|
113
|
-
provideDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend, token: vscode.CancellationToken): NullableResult<SemanticToken[]>;
|
|
114
|
-
provideWorkspaceSymbols?(query: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceSymbol[]>;
|
|
115
|
-
provideSyntacticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
116
|
-
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
117
|
-
provideDiagnosticMarkupContent?(diagnostic: vscode.Diagnostic, token: vscode.CancellationToken): NullableResult<vscode.MarkupContent>;
|
|
118
|
-
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
119
|
-
provideReferencesCodeLensRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Range[]>;
|
|
120
|
-
provideAutoInsertionEdit?(document: TextDocument, position: vscode.Position, context: AutoInsertionContext, token: vscode.CancellationToken): NullableResult<string | vscode.TextEdit>;
|
|
121
|
-
provideFileRenameEdits?(oldUri: string, newUri: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
122
|
-
provideFormattingIndentSensitiveLines?(document: TextDocument, token: vscode.CancellationToken): NullableResult<number[]>;
|
|
123
|
-
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Result<vscode.CodeLens>;
|
|
124
|
-
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): Result<vscode.CodeAction>;
|
|
125
|
-
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): Result<vscode.CompletionItem>;
|
|
126
|
-
resolveDocumentLink?(link: vscode.DocumentLink, token: vscode.CancellationToken): Result<vscode.DocumentLink>;
|
|
127
|
-
resolveInlayHint?(inlayHint: vscode.InlayHint, token: vscode.CancellationToken): Result<vscode.InlayHint>;
|
|
128
|
-
resolveReferencesCodeLensLocations?(document: TextDocument, range: vscode.Range, references: vscode.Location[], token: vscode.CancellationToken): Result<vscode.Location[]>;
|
|
129
|
-
resolveRuleContext?(context: RuleContext, ruleType: 'format' | 'syntax' | 'semantic'): Result<RuleContext>;
|
|
130
|
-
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
131
|
-
}
|
|
132
124
|
export interface Rule {
|
|
133
125
|
onFormat?(ctx: RuleContext): void;
|
|
134
126
|
onSyntax?(ctx: RuleContext): void;
|
|
135
127
|
onSemantic?(ctx: RuleContext): void;
|
|
136
128
|
}
|
|
137
129
|
export interface RuleContext {
|
|
138
|
-
|
|
139
|
-
* Shared modules.
|
|
140
|
-
*/
|
|
141
|
-
modules: {
|
|
142
|
-
typescript?: typeof import('typescript/lib/tsserverlibrary');
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* IDE or user define locale.
|
|
146
|
-
* You can use it to localize your rule.
|
|
147
|
-
*/
|
|
148
|
-
locale?: string;
|
|
149
|
-
/**
|
|
150
|
-
* Project root path.
|
|
151
|
-
*/
|
|
152
|
-
rootUri: URI;
|
|
153
|
-
uriToFileName(uri: string): string;
|
|
154
|
-
fileNameToUri(fileName: string): string;
|
|
155
|
-
/**
|
|
156
|
-
* Get configuration from IDE.
|
|
157
|
-
*
|
|
158
|
-
* For VSCode, it's .vscode/settings.json
|
|
159
|
-
*/
|
|
160
|
-
getConfiguration?: <T>(section: string) => Promise<T | undefined>;
|
|
161
|
-
onDidChangeConfiguration?: (cb: () => void) => void;
|
|
162
|
-
/**
|
|
163
|
-
* Global settings from config.
|
|
164
|
-
*/
|
|
165
|
-
settings: any;
|
|
130
|
+
env: ServiceEnvironment;
|
|
166
131
|
ruleId: string;
|
|
167
132
|
document: TextDocument;
|
|
168
133
|
report(error: vscode.Diagnostic, ...fixes: RuleFix[]): void;
|
|
@@ -189,10 +154,10 @@ export interface RuleFix {
|
|
|
189
154
|
}
|
|
190
155
|
export interface Config {
|
|
191
156
|
languages?: {
|
|
192
|
-
[id: string]:
|
|
157
|
+
[id: string]: Language | undefined;
|
|
193
158
|
};
|
|
194
|
-
|
|
195
|
-
[id: string]:
|
|
159
|
+
services?: {
|
|
160
|
+
[id: string]: Service | undefined;
|
|
196
161
|
};
|
|
197
162
|
lint?: {
|
|
198
163
|
rules?: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Service, ServiceContext, Rule, RuleContext } from '../types';
|
|
3
3
|
import { FileRangeCapabilities, VirtualFile } from '@volar/language-service';
|
|
4
4
|
import { SourceMapWithDocuments } from '../documents';
|
|
5
|
-
export declare function documentFeatureWorker<T>(context:
|
|
6
|
-
export declare function languageFeatureWorker<T, K>(context:
|
|
7
|
-
export declare function ruleWorker<T>(context:
|
|
5
|
+
export declare function documentFeatureWorker<T>(context: ServiceContext, uri: string, isValidSourceMap: (file: VirtualFile, sourceMap: SourceMapWithDocuments<FileRangeCapabilities>) => boolean, worker: (service: ReturnType<Service>, document: TextDocument) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
6
|
+
export declare function languageFeatureWorker<T, K>(context: ServiceContext, uri: string, arg: K, transformArg: (arg: K, sourceMap: SourceMapWithDocuments<FileRangeCapabilities>, file: VirtualFile) => Generator<K> | K[], worker: (service: ReturnType<Service>, document: TextDocument, arg: K, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined, file: VirtualFile | undefined) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>, reportProgress?: (result: NonNullable<Awaited<T>>) => void): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
7
|
+
export declare function ruleWorker<T>(context: ServiceContext, api: 'onSyntax' | 'onSemantic' | 'onFormat', uri: string, isValidSourceMap: (file: VirtualFile) => boolean, worker: (ruleName: string, rule: Rule, ruleCtx: RuleContext) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>, reportProgress?: (result: NonNullable<Awaited<T>>) => void): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
8
8
|
export declare function safeCall<T>(cb: () => Promise<T> | T, errorMsg?: string): Promise<T | undefined>;
|
|
@@ -72,15 +72,7 @@ async function ruleWorker(context, api, uri, isValidSourceMap, worker, transform
|
|
|
72
72
|
return true;
|
|
73
73
|
}
|
|
74
74
|
let ruleCtx = {
|
|
75
|
-
|
|
76
|
-
modules: { typescript: context.typescript?.module },
|
|
77
|
-
uriToFileName: context.uriToFileName,
|
|
78
|
-
fileNameToUri: context.fileNameToUri,
|
|
79
|
-
rootUri: context.rootUri,
|
|
80
|
-
locale: context.locale,
|
|
81
|
-
getConfiguration: context.configurationHost?.getConfiguration,
|
|
82
|
-
onDidChangeConfiguration: context.configurationHost?.onDidChangeConfiguration,
|
|
83
|
-
settings: context.config.lint?.settings ?? {},
|
|
75
|
+
env: context.env,
|
|
84
76
|
// document context
|
|
85
77
|
ruleId: '',
|
|
86
78
|
document: map.virtualFileDocument,
|
|
@@ -121,15 +113,7 @@ async function ruleWorker(context, api, uri, isValidSourceMap, worker, transform
|
|
|
121
113
|
}
|
|
122
114
|
else if (document) {
|
|
123
115
|
let ruleCtx = {
|
|
124
|
-
|
|
125
|
-
modules: { typescript: context.typescript?.module },
|
|
126
|
-
uriToFileName: context.uriToFileName,
|
|
127
|
-
fileNameToUri: context.fileNameToUri,
|
|
128
|
-
rootUri: context.rootUri,
|
|
129
|
-
locale: context.locale,
|
|
130
|
-
getConfiguration: context.configurationHost?.getConfiguration,
|
|
131
|
-
onDidChangeConfiguration: context.configurationHost?.onDidChangeConfiguration,
|
|
132
|
-
settings: context.config.lint?.settings ?? {},
|
|
116
|
+
env: context.env,
|
|
133
117
|
// document context
|
|
134
118
|
ruleId: '',
|
|
135
119
|
document,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-alpha.0",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.
|
|
17
|
-
"@volar/source-map": "1.
|
|
16
|
+
"@volar/language-core": "1.5.0-alpha.0",
|
|
17
|
+
"@volar/source-map": "1.5.0-alpha.0",
|
|
18
18
|
"typescript-auto-import-cache": "^0.2.1",
|
|
19
19
|
"vscode-html-languageservice": "^5.0.4",
|
|
20
20
|
"vscode-json-languageservice": "^5.2.0",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
23
23
|
"vscode-uri": "^3.0.7"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "a4e1b3766ccb5affe1613cad7630513b9073d275"
|
|
26
26
|
}
|