@volar/language-server 1.2.0-alpha.8 → 1.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/common/documents.js +6 -0
- package/out/common/features/customFeatures.js +9 -8
- package/out/common/features/languageFeatures.d.ts +3 -2
- package/out/common/features/languageFeatures.js +65 -44
- package/out/common/project.d.ts +8 -8
- package/out/common/project.js +3 -3
- package/out/common/server.js +1 -1
- package/out/common/utils/registerFeatures.js +9 -9
- package/out/common/workspace.d.ts +72 -72
- package/out/common/workspaces.d.ts +88 -88
- package/out/common/workspaces.js +2 -11
- package/out/protocol.d.ts +5 -3
- package/out/types.d.ts +8 -2
- package/package.json +10 -10
package/out/common/documents.js
CHANGED
|
@@ -153,12 +153,16 @@ function createDocuments(connection) {
|
|
|
153
153
|
const onDidChangeContents = new Set();
|
|
154
154
|
const onDidCloses = new Set();
|
|
155
155
|
connection.onDidOpenTextDocument(params => {
|
|
156
|
+
if (params.textDocument.uri.startsWith('git:/'))
|
|
157
|
+
return;
|
|
156
158
|
snapshots.uriSet(params.textDocument.uri, new IncrementalScriptSnapshot(params.textDocument.uri, params.textDocument.languageId, params.textDocument.version, params.textDocument.text));
|
|
157
159
|
for (const cb of onDidChangeContents) {
|
|
158
160
|
cb({ textDocument: params.textDocument, contentChanges: [{ text: params.textDocument.text }] });
|
|
159
161
|
}
|
|
160
162
|
});
|
|
161
163
|
connection.onDidChangeTextDocument(params => {
|
|
164
|
+
if (params.textDocument.uri.startsWith('git:/'))
|
|
165
|
+
return;
|
|
162
166
|
const incrementalSnapshot = snapshots.uriGet(params.textDocument.uri);
|
|
163
167
|
if (incrementalSnapshot) {
|
|
164
168
|
if (params.contentChanges.every(vscode.TextDocumentContentChangeEvent.isIncremental)) {
|
|
@@ -181,6 +185,8 @@ function createDocuments(connection) {
|
|
|
181
185
|
}
|
|
182
186
|
});
|
|
183
187
|
connection.onDidCloseTextDocument(params => {
|
|
188
|
+
if (params.textDocument.uri.startsWith('git:/'))
|
|
189
|
+
return;
|
|
184
190
|
snapshots.uriDelete(params.textDocument.uri);
|
|
185
191
|
for (const cb of onDidCloses) {
|
|
186
192
|
cb(params);
|
|
@@ -71,14 +71,15 @@ function register(connection, projects) {
|
|
|
71
71
|
}
|
|
72
72
|
}));
|
|
73
73
|
connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
var _p, _q;
|
|
74
|
+
var _p, _q, _r;
|
|
75
75
|
const project = yield projects.getProject(document.uri);
|
|
76
76
|
const fileNames = [];
|
|
77
77
|
if (project) {
|
|
78
78
|
const rootVirtualFile = (_q = (_p = project.project) === null || _p === void 0 ? void 0 : _p.getLanguageService().context.core.virtualFiles.getSource(shared.uriToFileName(document.uri))) === null || _q === void 0 ? void 0 : _q.root;
|
|
79
79
|
if (rootVirtualFile) {
|
|
80
|
+
const kinds = (_r = document.fileKinds) !== null && _r !== void 0 ? _r : [language_core_1.FileKind.TypeScriptHostFile];
|
|
80
81
|
(0, language_core_1.forEachEmbeddedFile)(rootVirtualFile, e => {
|
|
81
|
-
if (e.snapshot.getLength() && e.kind
|
|
82
|
+
if (e.snapshot.getLength() && kinds.includes(e.kind)) {
|
|
82
83
|
fileNames.push(e.fileName);
|
|
83
84
|
}
|
|
84
85
|
});
|
|
@@ -87,15 +88,15 @@ function register(connection, projects) {
|
|
|
87
88
|
return fileNames;
|
|
88
89
|
}));
|
|
89
90
|
connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
var
|
|
91
|
+
var _s, _t, _u, _v;
|
|
91
92
|
const project = yield projects.getProject(params.sourceFileUri);
|
|
92
93
|
if (project) {
|
|
93
|
-
const [virtualFile, source] = (
|
|
94
|
+
const [virtualFile, source] = (_t = (_s = project.project) === null || _s === void 0 ? void 0 : _s.getLanguageService().context.core.virtualFiles.getVirtualFile(params.virtualFileName)) !== null && _t !== void 0 ? _t : [];
|
|
94
95
|
if (virtualFile && source) {
|
|
95
96
|
const mappings = {};
|
|
96
97
|
for (const mapping of virtualFile.mappings) {
|
|
97
|
-
const sourceUri = shared.fileNameToUri((
|
|
98
|
-
(
|
|
98
|
+
const sourceUri = shared.fileNameToUri((_u = mapping.source) !== null && _u !== void 0 ? _u : source.fileName);
|
|
99
|
+
(_v = mappings[sourceUri]) !== null && _v !== void 0 ? _v : (mappings[sourceUri] = []);
|
|
99
100
|
mappings[sourceUri].push(mapping);
|
|
100
101
|
}
|
|
101
102
|
return {
|
|
@@ -109,11 +110,11 @@ function register(connection, projects) {
|
|
|
109
110
|
projects.reloadProject();
|
|
110
111
|
});
|
|
111
112
|
connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var
|
|
113
|
+
var _w;
|
|
113
114
|
const fs = yield Promise.resolve().then(() => require('fs'));
|
|
114
115
|
const project = yield projects.getProject(params.uri);
|
|
115
116
|
if (project) {
|
|
116
|
-
const ls = (
|
|
117
|
+
const ls = (_w = (yield project.project)) === null || _w === void 0 ? void 0 : _w.getLanguageServiceDontCreate();
|
|
117
118
|
if (ls) {
|
|
118
119
|
const sourceFiles = new Set(ls.context.host.getScriptFileNames());
|
|
119
120
|
for (const virtualFile of ls.context.core.typescript.languageServiceHost.getScriptFileNames()) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vscode from 'vscode-languageserver';
|
|
2
2
|
import { CancellationTokenHost } from '../cancellationPipe';
|
|
3
3
|
import type { Workspaces } from '../workspaces';
|
|
4
|
-
import { RuntimeEnvironment } from '../../types';
|
|
5
|
-
|
|
4
|
+
import { RuntimeEnvironment, LanguageServerInitializationOptions } from '../../types';
|
|
5
|
+
import { createDocuments } from '../documents';
|
|
6
|
+
export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, initOptions: LanguageServerInitializationOptions, cancelHost: CancellationTokenHost, semanticTokensLegend: vscode.SemanticTokensLegend, runtime: RuntimeEnvironment, documents: ReturnType<typeof createDocuments>): void;
|
|
@@ -13,7 +13,7 @@ const embedded = require("@volar/language-service");
|
|
|
13
13
|
const vscode = require("vscode-languageserver");
|
|
14
14
|
const protocol_1 = require("../../protocol");
|
|
15
15
|
const shared = require("@volar/shared");
|
|
16
|
-
function register(connection, projects, initParams, cancelHost, semanticTokensLegend, runtime) {
|
|
16
|
+
function register(connection, projects, initParams, initOptions, cancelHost, semanticTokensLegend, runtime, documents) {
|
|
17
17
|
let lastCompleteUri;
|
|
18
18
|
let lastCompleteLs;
|
|
19
19
|
let lastCodeLensLs;
|
|
@@ -66,13 +66,37 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
66
66
|
}));
|
|
67
67
|
connection.onCompletion((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
68
68
|
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
var _a;
|
|
69
70
|
lastCompleteUri = params.textDocument.uri;
|
|
70
71
|
lastCompleteLs = service;
|
|
72
|
+
const document = (_a = documents.data.uriGet(params.textDocument.uri)) === null || _a === void 0 ? void 0 : _a.getDocument();
|
|
71
73
|
const list = yield service.doComplete(params.textDocument.uri, params.position, params.context);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
for (const item of list.items) {
|
|
75
|
+
fixTextEdit(item);
|
|
76
|
+
}
|
|
77
|
+
if (!initOptions.fullCompletionList && document) {
|
|
78
|
+
list.items = list.items.filter(item => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const range = item.textEdit ? (vscode.InsertReplaceEdit.is(item.textEdit)
|
|
81
|
+
? item.textEdit.replace
|
|
82
|
+
: item.textEdit.range) : ((_a = list.itemDefaults) === null || _a === void 0 ? void 0 : _a.editRange) ? (vscode.Range.is(list.itemDefaults.editRange)
|
|
83
|
+
? list.itemDefaults.editRange
|
|
84
|
+
: list.itemDefaults.editRange.replace) : undefined;
|
|
85
|
+
if (range) {
|
|
86
|
+
const sourceText = document.getText(range).toLowerCase();
|
|
87
|
+
if (sourceText.trim()) {
|
|
88
|
+
let filterText = ((_b = item.filterText) !== null && _b !== void 0 ? _b : item.label).toLowerCase();
|
|
89
|
+
for (const char of sourceText) {
|
|
90
|
+
const index = filterText.indexOf(char);
|
|
91
|
+
if (index === -1) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
filterText = filterText.slice(index + 1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
});
|
|
76
100
|
}
|
|
77
101
|
return list;
|
|
78
102
|
}));
|
|
@@ -111,30 +135,27 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
111
135
|
}));
|
|
112
136
|
}));
|
|
113
137
|
connection.onCodeLensResolve((codeLens) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
var
|
|
115
|
-
return (
|
|
138
|
+
var _b;
|
|
139
|
+
return (_b = yield (lastCodeLensLs === null || lastCodeLensLs === void 0 ? void 0 : lastCodeLensLs.doCodeLensResolve(codeLens))) !== null && _b !== void 0 ? _b : codeLens;
|
|
116
140
|
}));
|
|
117
|
-
connection.onExecuteCommand((params
|
|
118
|
-
if (params.command === embedded.
|
|
141
|
+
connection.onExecuteCommand((params) => __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
if (params.command === embedded.showReferencesCommand
|
|
143
|
+
&& params.arguments) {
|
|
119
144
|
const args = params.arguments;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
workDoneProgress,
|
|
127
|
-
applyEdit: (paramOrEdit) => connection.workspace.applyEdit(paramOrEdit),
|
|
128
|
-
showReferences: (params) => connection.sendNotification(protocol_1.ShowReferencesNotification.type, params),
|
|
129
|
-
});
|
|
145
|
+
yield connection.sendNotification(protocol_1.ShowReferencesNotification.type, {
|
|
146
|
+
textDocument: {
|
|
147
|
+
uri: args[0],
|
|
148
|
+
},
|
|
149
|
+
position: args[1],
|
|
150
|
+
references: args[2],
|
|
130
151
|
});
|
|
131
152
|
}
|
|
132
153
|
}));
|
|
133
154
|
connection.onCodeAction((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
134
155
|
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
var
|
|
156
|
+
var _c, _d, _e;
|
|
136
157
|
lastCodeActionLs = service;
|
|
137
|
-
let codeActions = (
|
|
158
|
+
let codeActions = (_c = yield service.doCodeActions(params.textDocument.uri, params.range, params.context)) !== null && _c !== void 0 ? _c : [];
|
|
138
159
|
for (const codeAction of codeActions) {
|
|
139
160
|
if (codeAction.data && typeof codeAction.data === 'object') {
|
|
140
161
|
codeAction.data.uri = params.textDocument.uri;
|
|
@@ -143,15 +164,15 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
143
164
|
codeAction.data = { uri: params.textDocument.uri };
|
|
144
165
|
}
|
|
145
166
|
}
|
|
146
|
-
if (!((
|
|
167
|
+
if (!((_e = (_d = initParams.capabilities.textDocument) === null || _d === void 0 ? void 0 : _d.codeAction) === null || _e === void 0 ? void 0 : _e.disabledSupport)) {
|
|
147
168
|
codeActions = codeActions.filter(codeAction => !codeAction.disabled);
|
|
148
169
|
}
|
|
149
170
|
return codeActions;
|
|
150
171
|
}));
|
|
151
172
|
}));
|
|
152
173
|
connection.onCodeActionResolve((codeAction) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
var
|
|
154
|
-
return (
|
|
174
|
+
var _f;
|
|
175
|
+
return (_f = yield lastCodeActionLs.doCodeActionResolve(codeAction)) !== null && _f !== void 0 ? _f : codeAction;
|
|
155
176
|
}));
|
|
156
177
|
connection.onReferences((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
157
178
|
return worker(params.textDocument.uri, token, service => {
|
|
@@ -204,37 +225,37 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
204
225
|
return results;
|
|
205
226
|
}));
|
|
206
227
|
connection.languages.callHierarchy.onPrepare((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
var
|
|
208
|
-
return (
|
|
228
|
+
var _g;
|
|
229
|
+
return (_g = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
209
230
|
lastCallHierarchyLs = service;
|
|
210
231
|
return service.callHierarchy.doPrepare(params.textDocument.uri, params.position);
|
|
211
|
-
}))) !== null &&
|
|
232
|
+
}))) !== null && _g !== void 0 ? _g : [];
|
|
212
233
|
}));
|
|
213
234
|
connection.languages.callHierarchy.onIncomingCalls((params) => __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
var
|
|
215
|
-
return (
|
|
235
|
+
var _h;
|
|
236
|
+
return (_h = yield (lastCallHierarchyLs === null || lastCallHierarchyLs === void 0 ? void 0 : lastCallHierarchyLs.callHierarchy.getIncomingCalls(params.item))) !== null && _h !== void 0 ? _h : [];
|
|
216
237
|
}));
|
|
217
238
|
connection.languages.callHierarchy.onOutgoingCalls((params) => __awaiter(this, void 0, void 0, function* () {
|
|
218
|
-
var
|
|
219
|
-
return (
|
|
239
|
+
var _j;
|
|
240
|
+
return (_j = yield (lastCallHierarchyLs === null || lastCallHierarchyLs === void 0 ? void 0 : lastCallHierarchyLs.callHierarchy.getOutgoingCalls(params.item))) !== null && _j !== void 0 ? _j : [];
|
|
220
241
|
}));
|
|
221
242
|
connection.languages.semanticTokens.on((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
222
|
-
var
|
|
243
|
+
var _k;
|
|
223
244
|
yield shared.sleep(200);
|
|
224
|
-
return (
|
|
225
|
-
var
|
|
226
|
-
const result = (
|
|
245
|
+
return (_k = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
var _l;
|
|
247
|
+
const result = (_l = yield (service === null || service === void 0 ? void 0 : service.getSemanticTokens(params.textDocument.uri, undefined, semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _l !== void 0 ? _l : [];
|
|
227
248
|
return buildTokens(result);
|
|
228
|
-
}))) !== null &&
|
|
249
|
+
}))) !== null && _k !== void 0 ? _k : buildTokens([]);
|
|
229
250
|
}));
|
|
230
251
|
connection.languages.semanticTokens.onRange((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
var
|
|
252
|
+
var _m;
|
|
232
253
|
yield shared.sleep(200);
|
|
233
|
-
return (
|
|
234
|
-
var
|
|
235
|
-
const result = (
|
|
254
|
+
return (_m = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
var _o;
|
|
256
|
+
const result = (_o = yield (service === null || service === void 0 ? void 0 : service.getSemanticTokens(params.textDocument.uri, params.range, semanticTokensLegend, token, tokens => resultProgress === null || resultProgress === void 0 ? void 0 : resultProgress.report(buildTokens(tokens))))) !== null && _o !== void 0 ? _o : [];
|
|
236
257
|
return buildTokens(result);
|
|
237
|
-
}))) !== null &&
|
|
258
|
+
}))) !== null && _m !== void 0 ? _m : buildTokens([]);
|
|
238
259
|
}));
|
|
239
260
|
connection.languages.diagnostics.on((params, token, _workDoneProgressReporter, resultProgressReporter) => __awaiter(this, void 0, void 0, function* () {
|
|
240
261
|
const result = yield worker(params.textDocument.uri, token, service => {
|
|
@@ -268,11 +289,11 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
268
289
|
return null;
|
|
269
290
|
}
|
|
270
291
|
const _edits = yield Promise.all(params.files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
271
|
-
var
|
|
272
|
-
return (
|
|
292
|
+
var _p;
|
|
293
|
+
return (_p = yield worker(file.oldUri, token, service => {
|
|
273
294
|
var _a;
|
|
274
295
|
return (_a = service.getEditsForFileRename(file.oldUri, file.newUri)) !== null && _a !== void 0 ? _a : null;
|
|
275
|
-
})) !== null &&
|
|
296
|
+
})) !== null && _p !== void 0 ? _p : null;
|
|
276
297
|
})));
|
|
277
298
|
const edits = _edits.filter(shared.notEmpty);
|
|
278
299
|
if (edits.length) {
|
package/out/common/project.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
59
59
|
};
|
|
60
60
|
languageServiceHost: embedded.LanguageServiceHost;
|
|
61
61
|
getLanguageService: () => {
|
|
62
|
+
triggerCharacters: string[];
|
|
62
63
|
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
|
|
63
64
|
ch: string;
|
|
64
65
|
position: embeddedLS.Position;
|
|
@@ -66,7 +67,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
66
67
|
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
|
|
67
68
|
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
|
|
68
69
|
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
|
|
69
|
-
findDocumentSymbols: (uri: string) => Promise<embeddedLS.
|
|
70
|
+
findDocumentSymbols: (uri: string) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
70
71
|
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
71
72
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
72
73
|
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
@@ -89,7 +90,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
89
90
|
doCodeLensResolve: (item: embeddedLS.CodeLens) => Promise<embeddedLS.CodeLens>;
|
|
90
91
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
91
92
|
findDocumentLinks: (uri: string) => Promise<embeddedLS.DocumentLink[]>;
|
|
92
|
-
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.
|
|
93
|
+
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
93
94
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: {
|
|
94
95
|
lastChange: {
|
|
95
96
|
range: embeddedLS.Range;
|
|
@@ -98,7 +99,6 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
98
99
|
text: string;
|
|
99
100
|
};
|
|
100
101
|
}) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>;
|
|
101
|
-
doExecuteCommand: (command: string, args: embeddedLS.ExecutePluginCommandArgs, executeCommandContext: embeddedLS.ExecuteCommandContext) => Promise<void>;
|
|
102
102
|
getInlayHints: (uri: string, range: embeddedLS.Range) => Promise<embeddedLS.InlayHint[] | undefined>;
|
|
103
103
|
callHierarchy: {
|
|
104
104
|
doPrepare(uri: string, position: embeddedLS.Position): Promise<embeddedLS.CallHierarchyItem[] | undefined>;
|
|
@@ -106,9 +106,10 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
106
106
|
getOutgoingCalls(item: embeddedLS.CallHierarchyItem): Promise<embeddedLS.CallHierarchyOutgoingCall[]>;
|
|
107
107
|
};
|
|
108
108
|
dispose: () => void | undefined;
|
|
109
|
-
context: embeddedLS.
|
|
109
|
+
context: embeddedLS.LanguageServicePluginContext;
|
|
110
110
|
};
|
|
111
111
|
getLanguageServiceDontCreate: () => {
|
|
112
|
+
triggerCharacters: string[];
|
|
112
113
|
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
|
|
113
114
|
ch: string;
|
|
114
115
|
position: embeddedLS.Position;
|
|
@@ -116,7 +117,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
116
117
|
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
|
|
117
118
|
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
|
|
118
119
|
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
|
|
119
|
-
findDocumentSymbols: (uri: string) => Promise<embeddedLS.
|
|
120
|
+
findDocumentSymbols: (uri: string) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
120
121
|
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
121
122
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
122
123
|
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
@@ -139,7 +140,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
139
140
|
doCodeLensResolve: (item: embeddedLS.CodeLens) => Promise<embeddedLS.CodeLens>;
|
|
140
141
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
141
142
|
findDocumentLinks: (uri: string) => Promise<embeddedLS.DocumentLink[]>;
|
|
142
|
-
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.
|
|
143
|
+
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
143
144
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: {
|
|
144
145
|
lastChange: {
|
|
145
146
|
range: embeddedLS.Range;
|
|
@@ -148,7 +149,6 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
148
149
|
text: string;
|
|
149
150
|
};
|
|
150
151
|
}) => Promise<NonNullable<string | embeddedLS.TextEdit | null | undefined> | undefined>;
|
|
151
|
-
doExecuteCommand: (command: string, args: embeddedLS.ExecutePluginCommandArgs, executeCommandContext: embeddedLS.ExecuteCommandContext) => Promise<void>;
|
|
152
152
|
getInlayHints: (uri: string, range: embeddedLS.Range) => Promise<embeddedLS.InlayHint[] | undefined>;
|
|
153
153
|
callHierarchy: {
|
|
154
154
|
doPrepare(uri: string, position: embeddedLS.Position): Promise<embeddedLS.CallHierarchyItem[] | undefined>;
|
|
@@ -156,7 +156,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
156
156
|
getOutgoingCalls(item: embeddedLS.CallHierarchyItem): Promise<embeddedLS.CallHierarchyOutgoingCall[]>;
|
|
157
157
|
};
|
|
158
158
|
dispose: () => void | undefined;
|
|
159
|
-
context: embeddedLS.
|
|
159
|
+
context: embeddedLS.LanguageServicePluginContext;
|
|
160
160
|
} | undefined;
|
|
161
161
|
getParsedCommandLine: () => ts.ParsedCommandLine;
|
|
162
162
|
tryAddFile: (fileName: string) => void;
|
package/out/common/project.js
CHANGED
|
@@ -62,12 +62,12 @@ function createProject(context) {
|
|
|
62
62
|
dispose,
|
|
63
63
|
};
|
|
64
64
|
function getLanguageService() {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
65
|
+
var _a, _b, _c, _d, _e, _f;
|
|
66
66
|
if (!languageService) {
|
|
67
67
|
const config = {
|
|
68
68
|
languages: Object.assign({}, (_a = context.serverConfig) === null || _a === void 0 ? void 0 : _a.languages),
|
|
69
69
|
plugins: Object.assign({}, (_b = context.serverConfig) === null || _b === void 0 ? void 0 : _b.plugins),
|
|
70
|
-
|
|
70
|
+
lint: Object.assign(Object.assign({}, (_c = context.serverConfig) === null || _c === void 0 ? void 0 : _c.lint), { rules: Object.assign({}, (_e = (_d = context.serverConfig) === null || _d === void 0 ? void 0 : _d.lint) === null || _e === void 0 ? void 0 : _e.rules) }),
|
|
71
71
|
};
|
|
72
72
|
const env = {
|
|
73
73
|
rootUri: context.rootUri,
|
|
@@ -91,7 +91,7 @@ function createProject(context) {
|
|
|
91
91
|
host: languageServiceHost,
|
|
92
92
|
};
|
|
93
93
|
for (const plugin of context.workspace.workspaces.plugins) {
|
|
94
|
-
(
|
|
94
|
+
(_f = plugin.resolveConfig) === null || _f === void 0 ? void 0 : _f.call(plugin, config, lsCtx);
|
|
95
95
|
}
|
|
96
96
|
languageService = embeddedLS.createLanguageService(languageServiceHost, config, env, context.documentRegistry);
|
|
97
97
|
}
|
package/out/common/server.js
CHANGED
|
@@ -127,7 +127,7 @@ function startCommonLanguageServer(context) {
|
|
|
127
127
|
projects.add(root);
|
|
128
128
|
}
|
|
129
129
|
(yield Promise.resolve().then(() => require('./features/customFeatures'))).register(context.connection, projects);
|
|
130
|
-
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(context.connection, projects, initParams, cancelTokenHost, getSemanticTokensLegend(), context.runtimeEnv);
|
|
130
|
+
(yield Promise.resolve().then(() => require('./features/languageFeatures'))).register(context.connection, projects, initParams, options, cancelTokenHost, getSemanticTokensLegend(), context.runtimeEnv, documents);
|
|
131
131
|
for (const plugin of plugins) {
|
|
132
132
|
(_a = plugin.onInitialized) === null || _a === void 0 ? void 0 : _a.call(plugin, getLanguageService);
|
|
133
133
|
}
|
|
@@ -4,7 +4,7 @@ const embedded = require("@volar/language-service");
|
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const vscode = require("vscode-languageserver");
|
|
6
6
|
function setupCapabilities(params, server, initOptions, plugins, semanticTokensLegend) {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
8
8
|
// Syntactic
|
|
9
9
|
if (!initOptions.respectClientCapabilities || ((_a = params.textDocument) === null || _a === void 0 ? void 0 : _a.selectionRange)) {
|
|
10
10
|
server.selectionRangeProvider = true;
|
|
@@ -85,17 +85,17 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
85
85
|
server.codeLensProvider = {
|
|
86
86
|
resolveProvider: true,
|
|
87
87
|
};
|
|
88
|
-
|
|
89
|
-
server.executeCommandProvider.commands.push(embedded.
|
|
88
|
+
(_x = server.executeCommandProvider) !== null && _x !== void 0 ? _x : (server.executeCommandProvider = { commands: [] });
|
|
89
|
+
server.executeCommandProvider.commands.push(embedded.showReferencesCommand);
|
|
90
90
|
}
|
|
91
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
91
|
+
if (!initOptions.respectClientCapabilities || ((_y = params.textDocument) === null || _y === void 0 ? void 0 : _y.semanticTokens)) {
|
|
92
92
|
server.semanticTokensProvider = {
|
|
93
93
|
range: true,
|
|
94
94
|
full: false,
|
|
95
95
|
legend: semanticTokensLegend,
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
98
|
+
if (!initOptions.respectClientCapabilities || ((_z = params.textDocument) === null || _z === void 0 ? void 0 : _z.codeAction)) {
|
|
99
99
|
server.codeActionProvider = {
|
|
100
100
|
codeActionKinds: [
|
|
101
101
|
vscode.CodeActionKind.Empty,
|
|
@@ -111,10 +111,10 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
111
111
|
resolveProvider: true,
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
114
|
+
if (!initOptions.respectClientCapabilities || ((_0 = params.textDocument) === null || _0 === void 0 ? void 0 : _0.inlayHint)) {
|
|
115
115
|
server.inlayHintProvider = true;
|
|
116
116
|
}
|
|
117
|
-
if ((!initOptions.respectClientCapabilities || ((
|
|
117
|
+
if ((!initOptions.respectClientCapabilities || ((_1 = params.textDocument) === null || _1 === void 0 ? void 0 : _1.diagnostic)) && ((_2 = initOptions.diagnosticModel) !== null && _2 !== void 0 ? _2 : types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
|
|
118
118
|
const selector = plugins.map(plugin => { var _a; return (_a = plugin.diagnosticDocumentSelector) !== null && _a !== void 0 ? _a : []; }).flat();
|
|
119
119
|
if (selector) {
|
|
120
120
|
server.diagnosticProvider = {
|
|
@@ -125,7 +125,7 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
// cross file features
|
|
128
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
128
|
+
if (!initOptions.respectClientCapabilities || ((_3 = params.workspace) === null || _3 === void 0 ? void 0 : _3.fileOperations)) {
|
|
129
129
|
const exts = plugins.map(plugin => plugin.extensions.fileRenameOperationFilter).flat();
|
|
130
130
|
if (exts.length) {
|
|
131
131
|
server.workspace = {
|
|
@@ -143,7 +143,7 @@ function setupCapabilities(params, server, initOptions, plugins, semanticTokensL
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
if (!initOptions.respectClientCapabilities || ((
|
|
146
|
+
if (!initOptions.respectClientCapabilities || ((_4 = params.workspace) === null || _4 === void 0 ? void 0 : _4.symbol)) {
|
|
147
147
|
server.workspaceSymbolProvider = true;
|
|
148
148
|
}
|
|
149
149
|
}
|