support commands

pull/2748/head
Martin Aeschlimann 2021-08-16 16:05:17 +02:00
parent 874d98a040
commit c7c029db8e
No known key found for this signature in database
GPG Key ID: 2609A01E695523E3
3 changed files with 10 additions and 4 deletions

6
package-lock.json generated
View File

@ -449,9 +449,9 @@
"dev": true
},
"vscode-json-languageservice": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.1.6.tgz",
"integrity": "sha512-DIKb3tcfRtb3tIE6g9SLOl5E9tNSt6kljH08Wa5RwFlVshtXGrDDzttchze4CYy9pJpE9mBtCbRHmLvY1Z1ZXA==",
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.1.7.tgz",
"integrity": "sha512-cwG5TwZyHYthsk2aS3W1dVgVP6Vwn3o+zscwN58uMgZt/nKuyxd9vdEB1F58Ix+S5kSKAnkUCP6hvulcoImQQQ==",
"dev": true,
"requires": {
"jsonc-parser": "^3.0.0",

View File

@ -32,7 +32,7 @@
"requirejs": "^2.3.6",
"terser": "^5.6.0",
"typescript": "4.2.4",
"vscode-json-languageservice": "4.1.6",
"vscode-json-languageservice": "4.1.7",
"vscode-uri": "3.0.2"
},
"husky": {

View File

@ -310,6 +310,11 @@ function toTextEdit(textEdit: jsonService.TextEdit): editor.ISingleEditOperation
range: toRange(textEdit.range),
text: textEdit.newText
};
}
function toCommand(c: jsonService.Command | undefined): languages.Command {
return c && c.command === 'editor.action.triggerSuggest' ? { id: c.command, title: c.title, arguments: c.arguments } : undefined
}
export class CompletionAdapter implements languages.CompletionItemProvider {
@ -351,6 +356,7 @@ export class CompletionAdapter implements languages.CompletionItemProvider {
filterText: entry.filterText,
documentation: entry.documentation,
detail: entry.detail,
command: toCommand(entry.command),
range: wordRange,
kind: toCompletionItemKind(entry.kind)
};