@volar/language-server 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/features/languageFeatures.js +52 -35
- package/package.json +5 -5
|
@@ -5,6 +5,7 @@ const language_service_1 = require("@volar/language-service");
|
|
|
5
5
|
const vscode = require("vscode-languageserver");
|
|
6
6
|
const vscode_uri_1 = require("vscode-uri");
|
|
7
7
|
const protocol_1 = require("../../protocol");
|
|
8
|
+
const reportedCapabilities = new Set();
|
|
8
9
|
function register(server, documents, configurations) {
|
|
9
10
|
// Diagnostics support
|
|
10
11
|
let refreshReq = 0;
|
|
@@ -303,14 +304,14 @@ function register(server, documents, configurations) {
|
|
|
303
304
|
return await lastInlayHintLs?.resolveInlayHint(hint, token) ?? hint;
|
|
304
305
|
});
|
|
305
306
|
}
|
|
306
|
-
|
|
307
|
-
|
|
307
|
+
refreshHandlers.push(() => {
|
|
308
|
+
if (initializeParams.capabilities.workspace?.inlayHint?.refreshSupport) {
|
|
308
309
|
server.connection.languages.inlayHint.refresh();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
wranCapabilitiesNotSupported('workspace.inlayHint.refreshSupport');
|
|
313
|
+
}
|
|
314
|
+
});
|
|
314
315
|
}
|
|
315
316
|
if (languageServicePlugins.some(({ capabilities }) => capabilities.signatureHelpProvider)) {
|
|
316
317
|
serverCapabilities.signatureHelpProvider = {
|
|
@@ -370,14 +371,14 @@ function register(server, documents, configurations) {
|
|
|
370
371
|
return await languageService?.getSemanticTokens(uri, params.range, serverCapabilities.semanticTokensProvider.legend, tokens => resultProgress?.report(tokens), token);
|
|
371
372
|
}) ?? { data: [] };
|
|
372
373
|
});
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
refreshHandlers.push(() => {
|
|
375
|
+
if (initializeParams.capabilities.workspace?.semanticTokens?.refreshSupport) {
|
|
375
376
|
server.connection.languages.semanticTokens.refresh();
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
wranCapabilitiesNotSupported('workspace.semanticTokens.refreshSupport');
|
|
380
|
+
}
|
|
381
|
+
});
|
|
381
382
|
}
|
|
382
383
|
if (languageServicePlugins.some(({ capabilities }) => capabilities.codeActionProvider)) {
|
|
383
384
|
serverCapabilities.codeActionProvider = {
|
|
@@ -398,8 +399,10 @@ function register(server, documents, configurations) {
|
|
|
398
399
|
codeAction.data = { uri: params.textDocument.uri };
|
|
399
400
|
}
|
|
400
401
|
}
|
|
401
|
-
if (!initializeParams.capabilities.textDocument?.codeAction?.disabledSupport
|
|
402
|
+
if (!initializeParams.capabilities.textDocument?.codeAction?.disabledSupport
|
|
403
|
+
&& codeActions.some(codeAction => !codeAction.disabled)) {
|
|
402
404
|
codeActions = codeActions.filter(codeAction => !codeAction.disabled);
|
|
405
|
+
wranCapabilitiesNotSupported('textDocument.codeAction.disabledSupport');
|
|
403
406
|
}
|
|
404
407
|
return codeActions;
|
|
405
408
|
});
|
|
@@ -462,14 +465,14 @@ function register(server, documents, configurations) {
|
|
|
462
465
|
return languageService.getInlineValue(uri, params.range, params.context, token);
|
|
463
466
|
});
|
|
464
467
|
});
|
|
465
|
-
|
|
466
|
-
|
|
468
|
+
refreshHandlers.push(() => {
|
|
469
|
+
if (initializeParams.capabilities.workspace?.inlineValue?.refreshSupport) {
|
|
467
470
|
server.connection.languages.inlineValue.refresh();
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
wranCapabilitiesNotSupported('workspace.inlineValue.refreshSupport');
|
|
474
|
+
}
|
|
475
|
+
});
|
|
473
476
|
}
|
|
474
477
|
if (languageServicePlugins.some(({ capabilities }) => capabilities.autoInsertionProvider)) {
|
|
475
478
|
const triggerCharacterToConfigurationSections = new Map();
|
|
@@ -592,14 +595,14 @@ function register(server, documents, configurations) {
|
|
|
592
595
|
interFileDependencies: false,
|
|
593
596
|
workspaceDiagnostics,
|
|
594
597
|
};
|
|
595
|
-
|
|
596
|
-
|
|
598
|
+
refreshHandlers.push(() => {
|
|
599
|
+
if (initializeParams.capabilities.workspace?.diagnostics?.refreshSupport) {
|
|
597
600
|
server.connection.languages.diagnostics.refresh();
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
wranCapabilitiesNotSupported('workspace.diagnostics.refreshSupport');
|
|
604
|
+
}
|
|
605
|
+
});
|
|
603
606
|
}
|
|
604
607
|
else {
|
|
605
608
|
documents.onDidChangeContent(({ document }) => {
|
|
@@ -724,26 +727,40 @@ function register(server, documents, configurations) {
|
|
|
724
727
|
});
|
|
725
728
|
}
|
|
726
729
|
function handleCompletionItem(initializeParams, item) {
|
|
730
|
+
const snippetSupport = initializeParams.capabilities.textDocument?.completion?.completionItem?.snippetSupport ?? false;
|
|
727
731
|
const insertReplaceSupport = initializeParams.capabilities.textDocument?.completion?.completionItem?.insertReplaceSupport ?? false;
|
|
728
|
-
if (!
|
|
729
|
-
|
|
730
|
-
|
|
732
|
+
if (!snippetSupport && item.insertTextFormat === vscode.InsertTextFormat.Snippet) {
|
|
733
|
+
item.insertTextFormat = vscode.InsertTextFormat.PlainText;
|
|
734
|
+
if (item.insertText) {
|
|
735
|
+
item.insertText = item.insertText.replace(/\$\d+/g, '');
|
|
736
|
+
item.insertText = item.insertText.replace(/\${\d+:([^}]*)}/g, '');
|
|
731
737
|
}
|
|
738
|
+
wranCapabilitiesNotSupported('textDocument.completion.completionItem.snippetSupport');
|
|
739
|
+
}
|
|
740
|
+
if (!insertReplaceSupport && item.textEdit && vscode.InsertReplaceEdit.is(item.textEdit)) {
|
|
741
|
+
item.textEdit = vscode.TextEdit.replace(item.textEdit.insert, item.textEdit.newText);
|
|
742
|
+
wranCapabilitiesNotSupported('textDocument.completion.completionItem.insertReplaceSupport');
|
|
732
743
|
}
|
|
733
744
|
return item;
|
|
734
745
|
}
|
|
735
746
|
function handleDefinitions(initializeParams, type, items) {
|
|
736
747
|
const linkSupport = initializeParams.capabilities.textDocument?.[type]?.linkSupport ?? false;
|
|
737
748
|
if (!linkSupport) {
|
|
749
|
+
wranCapabilitiesNotSupported(`textDocument.${type}.linkSupport`);
|
|
738
750
|
return items.map(item => ({
|
|
739
751
|
uri: item.targetUri,
|
|
740
752
|
range: item.targetRange,
|
|
741
753
|
}));
|
|
742
754
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
755
|
+
return items;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function wranCapabilitiesNotSupported(path) {
|
|
759
|
+
if (reportedCapabilities.has(path)) {
|
|
760
|
+
return;
|
|
746
761
|
}
|
|
762
|
+
reportedCapabilities.add(path);
|
|
763
|
+
console.warn(`${path} is not supported by the client but could be used by the server.`);
|
|
747
764
|
}
|
|
748
765
|
function sleep(ms) {
|
|
749
766
|
return new Promise(resolve => setTimeout(resolve, ms));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"directory": "packages/language-server"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.4.
|
|
16
|
-
"@volar/language-service": "2.4.
|
|
17
|
-
"@volar/typescript": "2.4.
|
|
15
|
+
"@volar/language-core": "2.4.3",
|
|
16
|
+
"@volar/language-service": "2.4.3",
|
|
17
|
+
"@volar/typescript": "2.4.3",
|
|
18
18
|
"path-browserify": "^1.0.1",
|
|
19
19
|
"request-light": "^0.7.0",
|
|
20
20
|
"vscode-languageserver": "^9.0.1",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/path-browserify": "latest"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "74d897fa2e2b81aa2a71e7c95c869cd8415b50b7"
|
|
29
29
|
}
|