@volar/language-server 1.2.0-alpha.6 → 1.2.0-alpha.8
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.
|
@@ -20,55 +20,55 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
20
20
|
let lastCodeActionLs;
|
|
21
21
|
let lastCallHierarchyLs;
|
|
22
22
|
connection.onDocumentFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return worker(params.textDocument.uri, token,
|
|
24
|
-
return
|
|
23
|
+
return worker(params.textDocument.uri, token, service => {
|
|
24
|
+
return service.format(params.textDocument.uri, params.options);
|
|
25
25
|
});
|
|
26
26
|
}));
|
|
27
27
|
connection.onDocumentRangeFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
return worker(params.textDocument.uri, token,
|
|
29
|
-
return
|
|
28
|
+
return worker(params.textDocument.uri, token, service => {
|
|
29
|
+
return service.format(params.textDocument.uri, params.options, params.range);
|
|
30
30
|
});
|
|
31
31
|
}));
|
|
32
32
|
connection.onDocumentOnTypeFormatting((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return worker(params.textDocument.uri, token,
|
|
34
|
-
return
|
|
33
|
+
return worker(params.textDocument.uri, token, service => {
|
|
34
|
+
return service.format(params.textDocument.uri, params.options, undefined, params);
|
|
35
35
|
});
|
|
36
36
|
}));
|
|
37
37
|
connection.onSelectionRanges((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
return worker(params.textDocument.uri, token,
|
|
39
|
-
return
|
|
38
|
+
return worker(params.textDocument.uri, token, service => {
|
|
39
|
+
return service.getSelectionRanges(params.textDocument.uri, params.positions);
|
|
40
40
|
});
|
|
41
41
|
}));
|
|
42
42
|
connection.onFoldingRanges((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
return worker(params.textDocument.uri, token,
|
|
44
|
-
return
|
|
43
|
+
return worker(params.textDocument.uri, token, service => {
|
|
44
|
+
return service.getFoldingRanges(params.textDocument.uri);
|
|
45
45
|
});
|
|
46
46
|
}));
|
|
47
47
|
connection.languages.onLinkedEditingRange((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return worker(params.textDocument.uri, token,
|
|
49
|
-
return
|
|
48
|
+
return worker(params.textDocument.uri, token, service => {
|
|
49
|
+
return service.findLinkedEditingRanges(params.textDocument.uri, params.position);
|
|
50
50
|
});
|
|
51
51
|
}));
|
|
52
52
|
connection.onDocumentSymbol((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
return worker(params.textDocument.uri, token,
|
|
54
|
-
return
|
|
53
|
+
return worker(params.textDocument.uri, token, service => {
|
|
54
|
+
return service.findDocumentSymbols(params.textDocument.uri);
|
|
55
55
|
});
|
|
56
56
|
}));
|
|
57
57
|
connection.onDocumentColor((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return worker(params.textDocument.uri, token,
|
|
59
|
-
return
|
|
58
|
+
return worker(params.textDocument.uri, token, service => {
|
|
59
|
+
return service.findDocumentColors(params.textDocument.uri);
|
|
60
60
|
});
|
|
61
61
|
}));
|
|
62
62
|
connection.onColorPresentation((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return worker(params.textDocument.uri, token,
|
|
64
|
-
return
|
|
63
|
+
return worker(params.textDocument.uri, token, service => {
|
|
64
|
+
return service.getColorPresentations(params.textDocument.uri, params.color, params.range);
|
|
65
65
|
});
|
|
66
66
|
}));
|
|
67
67
|
connection.onCompletion((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return worker(params.textDocument.uri, token, (
|
|
68
|
+
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
lastCompleteUri = params.textDocument.uri;
|
|
70
|
-
lastCompleteLs =
|
|
71
|
-
const list = yield
|
|
70
|
+
lastCompleteLs = service;
|
|
71
|
+
const list = yield service.doComplete(params.textDocument.uri, params.position, params.context);
|
|
72
72
|
if (list) {
|
|
73
73
|
for (const item of list.items) {
|
|
74
74
|
fixTextEdit(item);
|
|
@@ -85,29 +85,29 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
85
85
|
return item;
|
|
86
86
|
}));
|
|
87
87
|
connection.onHover((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
return worker(params.textDocument.uri, token,
|
|
89
|
-
return
|
|
88
|
+
return worker(params.textDocument.uri, token, service => {
|
|
89
|
+
return service.doHover(params.textDocument.uri, params.position);
|
|
90
90
|
});
|
|
91
91
|
}));
|
|
92
92
|
connection.onSignatureHelp((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
return worker(params.textDocument.uri, token,
|
|
94
|
-
return
|
|
93
|
+
return worker(params.textDocument.uri, token, service => {
|
|
94
|
+
return service.getSignatureHelp(params.textDocument.uri, params.position, params.context);
|
|
95
95
|
});
|
|
96
96
|
}));
|
|
97
97
|
connection.onPrepareRename((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
return worker(params.textDocument.uri, token,
|
|
99
|
-
return
|
|
98
|
+
return worker(params.textDocument.uri, token, service => {
|
|
99
|
+
return service.prepareRename(params.textDocument.uri, params.position);
|
|
100
100
|
});
|
|
101
101
|
}));
|
|
102
102
|
connection.onRenameRequest((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
return worker(params.textDocument.uri, token,
|
|
104
|
-
return
|
|
103
|
+
return worker(params.textDocument.uri, token, service => {
|
|
104
|
+
return service.doRename(params.textDocument.uri, params.position, params.newName);
|
|
105
105
|
});
|
|
106
106
|
}));
|
|
107
107
|
connection.onCodeLens((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return worker(params.textDocument.uri, token, (
|
|
109
|
-
lastCodeLensLs =
|
|
110
|
-
return
|
|
108
|
+
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
lastCodeLensLs = service;
|
|
110
|
+
return service.doCodeLens(params.textDocument.uri);
|
|
111
111
|
}));
|
|
112
112
|
}));
|
|
113
113
|
connection.onCodeLensResolve((codeLens) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -120,8 +120,8 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
120
120
|
if (!args) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
return worker(args[0], token,
|
|
124
|
-
return
|
|
123
|
+
return worker(args[0], token, service => {
|
|
124
|
+
return service.doExecuteCommand(params.command, args, {
|
|
125
125
|
token,
|
|
126
126
|
workDoneProgress,
|
|
127
127
|
applyEdit: (paramOrEdit) => connection.workspace.applyEdit(paramOrEdit),
|
|
@@ -131,10 +131,10 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
131
131
|
}
|
|
132
132
|
}));
|
|
133
133
|
connection.onCodeAction((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
return worker(params.textDocument.uri, token, (
|
|
134
|
+
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
135
135
|
var _b, _c, _d;
|
|
136
|
-
lastCodeActionLs =
|
|
137
|
-
let codeActions = (_b = yield
|
|
136
|
+
lastCodeActionLs = service;
|
|
137
|
+
let codeActions = (_b = yield service.doCodeActions(params.textDocument.uri, params.range, params.context)) !== null && _b !== void 0 ? _b : [];
|
|
138
138
|
for (const codeAction of codeActions) {
|
|
139
139
|
if (codeAction.data && typeof codeAction.data === 'object') {
|
|
140
140
|
codeAction.data.uri = params.textDocument.uri;
|
|
@@ -154,38 +154,38 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
154
154
|
return (_e = yield lastCodeActionLs.doCodeActionResolve(codeAction)) !== null && _e !== void 0 ? _e : codeAction;
|
|
155
155
|
}));
|
|
156
156
|
connection.onReferences((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
return worker(params.textDocument.uri, token,
|
|
158
|
-
return
|
|
157
|
+
return worker(params.textDocument.uri, token, service => {
|
|
158
|
+
return service.findReferences(params.textDocument.uri, params.position);
|
|
159
159
|
});
|
|
160
160
|
}));
|
|
161
161
|
connection.onRequest(protocol_1.FindFileReferenceRequest.type, (params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
return worker(params.textDocument.uri, token,
|
|
163
|
-
return
|
|
162
|
+
return worker(params.textDocument.uri, token, service => {
|
|
163
|
+
return service.findFileReferences(params.textDocument.uri);
|
|
164
164
|
});
|
|
165
165
|
}));
|
|
166
166
|
connection.onImplementation((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
return worker(params.textDocument.uri, token,
|
|
168
|
-
return
|
|
167
|
+
return worker(params.textDocument.uri, token, service => {
|
|
168
|
+
return service.findImplementations(params.textDocument.uri, params.position);
|
|
169
169
|
});
|
|
170
170
|
}));
|
|
171
171
|
connection.onDefinition((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
return worker(params.textDocument.uri, token,
|
|
173
|
-
return
|
|
172
|
+
return worker(params.textDocument.uri, token, service => {
|
|
173
|
+
return service.findDefinition(params.textDocument.uri, params.position);
|
|
174
174
|
});
|
|
175
175
|
}));
|
|
176
176
|
connection.onTypeDefinition((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
return worker(params.textDocument.uri, token,
|
|
178
|
-
return
|
|
177
|
+
return worker(params.textDocument.uri, token, service => {
|
|
178
|
+
return service.findTypeDefinition(params.textDocument.uri, params.position);
|
|
179
179
|
});
|
|
180
180
|
}));
|
|
181
181
|
connection.onDocumentHighlight((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
return worker(params.textDocument.uri, token,
|
|
183
|
-
return
|
|
182
|
+
return worker(params.textDocument.uri, token, service => {
|
|
183
|
+
return service.findDocumentHighlights(params.textDocument.uri, params.position);
|
|
184
184
|
});
|
|
185
185
|
}));
|
|
186
186
|
connection.onDocumentLinks((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
return worker(params.textDocument.uri, token,
|
|
188
|
-
return
|
|
187
|
+
return worker(params.textDocument.uri, token, service => {
|
|
188
|
+
return service.findDocumentLinks(params.textDocument.uri);
|
|
189
189
|
});
|
|
190
190
|
}));
|
|
191
191
|
connection.onWorkspaceSymbol((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -197,17 +197,17 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
197
197
|
for (const project of projects) {
|
|
198
198
|
if (token.isCancellationRequested)
|
|
199
199
|
return;
|
|
200
|
-
const
|
|
201
|
-
results = results.concat(yield
|
|
200
|
+
const service = (yield project).getLanguageService();
|
|
201
|
+
results = results.concat(yield service.findWorkspaceSymbols(params.query));
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
return results;
|
|
205
205
|
}));
|
|
206
206
|
connection.languages.callHierarchy.onPrepare((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
207
207
|
var _f;
|
|
208
|
-
return (_f = yield worker(params.textDocument.uri, token, (
|
|
209
|
-
lastCallHierarchyLs =
|
|
210
|
-
return
|
|
208
|
+
return (_f = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
lastCallHierarchyLs = service;
|
|
210
|
+
return service.callHierarchy.doPrepare(params.textDocument.uri, params.position);
|
|
211
211
|
}))) !== null && _f !== void 0 ? _f : [];
|
|
212
212
|
}));
|
|
213
213
|
connection.languages.callHierarchy.onIncomingCalls((params) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -221,25 +221,25 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
221
221
|
connection.languages.semanticTokens.on((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
222
222
|
var _j;
|
|
223
223
|
yield shared.sleep(200);
|
|
224
|
-
return (_j = yield worker(params.textDocument.uri, token, (
|
|
224
|
+
return (_j = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
225
225
|
var _k;
|
|
226
|
-
const result = (_k = yield (
|
|
226
|
+
const result = (_k = 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 && _k !== void 0 ? _k : [];
|
|
227
227
|
return buildTokens(result);
|
|
228
228
|
}))) !== null && _j !== void 0 ? _j : buildTokens([]);
|
|
229
229
|
}));
|
|
230
230
|
connection.languages.semanticTokens.onRange((params, token, _, resultProgress) => __awaiter(this, void 0, void 0, function* () {
|
|
231
231
|
var _l;
|
|
232
232
|
yield shared.sleep(200);
|
|
233
|
-
return (_l = yield worker(params.textDocument.uri, token, (
|
|
233
|
+
return (_l = yield worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
234
234
|
var _m;
|
|
235
|
-
const result = (_m = yield (
|
|
235
|
+
const result = (_m = 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 && _m !== void 0 ? _m : [];
|
|
236
236
|
return buildTokens(result);
|
|
237
237
|
}))) !== null && _l !== void 0 ? _l : buildTokens([]);
|
|
238
238
|
}));
|
|
239
239
|
connection.languages.diagnostics.on((params, token, _workDoneProgressReporter, resultProgressReporter) => __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
const result = yield worker(params.textDocument.uri, token,
|
|
240
|
+
const result = yield worker(params.textDocument.uri, token, service => {
|
|
241
241
|
const tsToken = cancelHost.createCancellationToken(token);
|
|
242
|
-
return
|
|
242
|
+
return service.doValidation(params.textDocument.uri, tsToken, errors => {
|
|
243
243
|
// resultProgressReporter is undefined in vscode
|
|
244
244
|
resultProgressReporter === null || resultProgressReporter === void 0 ? void 0 : resultProgressReporter.report({
|
|
245
245
|
relatedDocuments: {
|
|
@@ -257,8 +257,8 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
257
257
|
};
|
|
258
258
|
}));
|
|
259
259
|
connection.languages.inlayHint.on((params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
260
|
-
return worker(params.textDocument.uri, token, (
|
|
261
|
-
return
|
|
260
|
+
return worker(params.textDocument.uri, token, (service) => __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
return service.getInlayHints(params.textDocument.uri, params.range);
|
|
262
262
|
}));
|
|
263
263
|
}));
|
|
264
264
|
// TODO: connection.languages.inlayHint.resolve
|
|
@@ -269,9 +269,9 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
269
269
|
}
|
|
270
270
|
const _edits = yield Promise.all(params.files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
271
271
|
var _o;
|
|
272
|
-
return (_o = yield worker(file.oldUri, token,
|
|
272
|
+
return (_o = yield worker(file.oldUri, token, service => {
|
|
273
273
|
var _a;
|
|
274
|
-
return (_a =
|
|
274
|
+
return (_a = service.getEditsForFileRename(file.oldUri, file.newUri)) !== null && _a !== void 0 ? _a : null;
|
|
275
275
|
})) !== null && _o !== void 0 ? _o : null;
|
|
276
276
|
})));
|
|
277
277
|
const edits = _edits.filter(shared.notEmpty);
|
|
@@ -282,8 +282,8 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
282
282
|
return null;
|
|
283
283
|
}));
|
|
284
284
|
connection.onRequest(protocol_1.AutoInsertRequest.type, (params, token) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
return worker(params.textDocument.uri, token,
|
|
286
|
-
return
|
|
285
|
+
return worker(params.textDocument.uri, token, service => {
|
|
286
|
+
return service.doAutoInsert(params.textDocument.uri, params.position, params.options);
|
|
287
287
|
});
|
|
288
288
|
}));
|
|
289
289
|
function worker(uri, token, cb) {
|
|
@@ -293,10 +293,10 @@ function register(connection, projects, initParams, cancelHost, semanticTokensLe
|
|
|
293
293
|
resolve(undefined);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
296
|
+
const service = yield getLanguageService(uri);
|
|
297
|
+
if (service) {
|
|
298
298
|
try { // handle TS cancel throw
|
|
299
|
-
const result = yield cb(
|
|
299
|
+
const result = yield cb(service);
|
|
300
300
|
if (token.isCancellationRequested) {
|
|
301
301
|
resolve(undefined);
|
|
302
302
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.8",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"directory": "packages/language-server"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@volar/language-core": "1.2.0-alpha.
|
|
21
|
-
"@volar/language-service": "1.2.0-alpha.
|
|
22
|
-
"@volar/shared": "1.2.0-alpha.
|
|
20
|
+
"@volar/language-core": "1.2.0-alpha.8",
|
|
21
|
+
"@volar/language-service": "1.2.0-alpha.8",
|
|
22
|
+
"@volar/shared": "1.2.0-alpha.8",
|
|
23
23
|
"@vscode/l10n": "^0.0.10",
|
|
24
24
|
"request-light": "^0.6.0",
|
|
25
25
|
"typesafe-path": "^0.2.2",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
30
30
|
"vscode-uri": "^3.0.7"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "9437b4560f35d2a153a9e2ae0dd0f64285bbb3b3"
|
|
33
33
|
}
|