@volar/language-server
Advanced tools
Comparing version 2.4.2 to 2.4.3
@@ -8,2 +8,3 @@ "use strict"; | ||
const protocol_1 = require("../../protocol"); | ||
const reportedCapabilities = new Set(); | ||
function register(server, documents, configurations) { | ||
@@ -307,10 +308,10 @@ // Diagnostics support | ||
} | ||
if (initializeParams.capabilities.workspace?.inlayHint?.refreshSupport) { | ||
refreshHandlers.push(() => { | ||
refreshHandlers.push(() => { | ||
if (initializeParams.capabilities.workspace?.inlayHint?.refreshSupport) { | ||
server.connection.languages.inlayHint.refresh(); | ||
}); | ||
} | ||
else { | ||
console.warn('Inlay hint refresh is not supported by the client.'); | ||
} | ||
} | ||
else { | ||
wranCapabilitiesNotSupported('workspace.inlayHint.refreshSupport'); | ||
} | ||
}); | ||
} | ||
@@ -375,10 +376,10 @@ if (languageServicePlugins.some(({ capabilities }) => capabilities.signatureHelpProvider)) { | ||
}); | ||
if (initializeParams.capabilities.workspace?.semanticTokens?.refreshSupport) { | ||
refreshHandlers.push(() => { | ||
refreshHandlers.push(() => { | ||
if (initializeParams.capabilities.workspace?.semanticTokens?.refreshSupport) { | ||
server.connection.languages.semanticTokens.refresh(); | ||
}); | ||
} | ||
else { | ||
console.warn('Semantic tokens refresh is not supported by the client.'); | ||
} | ||
} | ||
else { | ||
wranCapabilitiesNotSupported('workspace.semanticTokens.refreshSupport'); | ||
} | ||
}); | ||
} | ||
@@ -404,4 +405,6 @@ if (languageServicePlugins.some(({ capabilities }) => capabilities.codeActionProvider)) { | ||
} | ||
if (!initializeParams.capabilities.textDocument?.codeAction?.disabledSupport) { | ||
if (!initializeParams.capabilities.textDocument?.codeAction?.disabledSupport | ||
&& codeActions.some(codeAction => !codeAction.disabled)) { | ||
codeActions = codeActions.filter(codeAction => !codeAction.disabled); | ||
wranCapabilitiesNotSupported('textDocument.codeAction.disabledSupport'); | ||
} | ||
@@ -469,10 +472,10 @@ return codeActions; | ||
}); | ||
if (initializeParams.capabilities.workspace?.inlineValue?.refreshSupport) { | ||
refreshHandlers.push(() => { | ||
refreshHandlers.push(() => { | ||
if (initializeParams.capabilities.workspace?.inlineValue?.refreshSupport) { | ||
server.connection.languages.inlineValue.refresh(); | ||
}); | ||
} | ||
else { | ||
console.warn('Inline value refresh is not supported by the client.'); | ||
} | ||
} | ||
else { | ||
wranCapabilitiesNotSupported('workspace.inlineValue.refreshSupport'); | ||
} | ||
}); | ||
} | ||
@@ -600,10 +603,10 @@ if (languageServicePlugins.some(({ capabilities }) => capabilities.autoInsertionProvider)) { | ||
}; | ||
if (initializeParams.capabilities.workspace?.diagnostics?.refreshSupport) { | ||
refreshHandlers.push(() => { | ||
refreshHandlers.push(() => { | ||
if (initializeParams.capabilities.workspace?.diagnostics?.refreshSupport) { | ||
server.connection.languages.diagnostics.refresh(); | ||
}); | ||
} | ||
else { | ||
console.warn('Diagnostics refresh is not supported by the client.'); | ||
} | ||
} | ||
else { | ||
wranCapabilitiesNotSupported('workspace.diagnostics.refreshSupport'); | ||
} | ||
}); | ||
} | ||
@@ -733,8 +736,16 @@ else { | ||
function handleCompletionItem(initializeParams, item) { | ||
const snippetSupport = initializeParams.capabilities.textDocument?.completion?.completionItem?.snippetSupport ?? false; | ||
const insertReplaceSupport = initializeParams.capabilities.textDocument?.completion?.completionItem?.insertReplaceSupport ?? false; | ||
if (!insertReplaceSupport) { | ||
if (item.textEdit && vscode.InsertReplaceEdit.is(item.textEdit)) { | ||
item.textEdit = vscode.TextEdit.replace(item.textEdit.insert, item.textEdit.newText); | ||
if (!snippetSupport && item.insertTextFormat === vscode.InsertTextFormat.Snippet) { | ||
item.insertTextFormat = vscode.InsertTextFormat.PlainText; | ||
if (item.insertText) { | ||
item.insertText = item.insertText.replace(/\$\d+/g, ''); | ||
item.insertText = item.insertText.replace(/\${\d+:([^}]*)}/g, ''); | ||
} | ||
wranCapabilitiesNotSupported('textDocument.completion.completionItem.snippetSupport'); | ||
} | ||
if (!insertReplaceSupport && item.textEdit && vscode.InsertReplaceEdit.is(item.textEdit)) { | ||
item.textEdit = vscode.TextEdit.replace(item.textEdit.insert, item.textEdit.newText); | ||
wranCapabilitiesNotSupported('textDocument.completion.completionItem.insertReplaceSupport'); | ||
} | ||
return item; | ||
@@ -745,2 +756,3 @@ } | ||
if (!linkSupport) { | ||
wranCapabilitiesNotSupported(`textDocument.${type}.linkSupport`); | ||
return items.map(item => ({ | ||
@@ -751,7 +763,12 @@ uri: item.targetUri, | ||
} | ||
else { | ||
return items; | ||
} | ||
return items; | ||
} | ||
} | ||
function wranCapabilitiesNotSupported(path) { | ||
if (reportedCapabilities.has(path)) { | ||
return; | ||
} | ||
reportedCapabilities.add(path); | ||
console.warn(`${path} is not supported by the client but could be used by the server.`); | ||
} | ||
function sleep(ms) { | ||
@@ -758,0 +775,0 @@ return new Promise(resolve => setTimeout(resolve, ms)); |
{ | ||
"name": "@volar/language-server", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"license": "MIT", | ||
@@ -15,5 +15,5 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.4.2", | ||
"@volar/language-service": "2.4.2", | ||
"@volar/typescript": "2.4.2", | ||
"@volar/language-core": "2.4.3", | ||
"@volar/language-service": "2.4.3", | ||
"@volar/typescript": "2.4.3", | ||
"path-browserify": "^1.0.1", | ||
@@ -29,3 +29,3 @@ "request-light": "^0.7.0", | ||
}, | ||
"gitHead": "f384d55ef4ae21e9f9a6796c9676a4a710458ed9" | ||
"gitHead": "74d897fa2e2b81aa2a71e7c95c869cd8415b50b7" | ||
} |
145270
2981
+ Added@volar/language-core@2.4.3(transitive)
+ Added@volar/language-service@2.4.3(transitive)
+ Added@volar/source-map@2.4.3(transitive)
+ Added@volar/typescript@2.4.3(transitive)
- Removed@volar/language-core@2.4.2(transitive)
- Removed@volar/language-service@2.4.2(transitive)
- Removed@volar/source-map@2.4.2(transitive)
- Removed@volar/typescript@2.4.2(transitive)
Updated@volar/language-core@2.4.3
Updated@volar/typescript@2.4.3