From c7c029db8e955092b148d0d0963849665fd1be68 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 16 Aug 2021 16:05:17 +0200 Subject: [PATCH] support commands --- package-lock.json | 6 +++--- package.json | 2 +- src/languageFeatures.ts | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2af47f7e..e4a02501 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 89e94235..327a0335 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/languageFeatures.ts b/src/languageFeatures.ts index 3c764eb8..794fa02d 100644 --- a/src/languageFeatures.ts +++ b/src/languageFeatures.ts @@ -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) };