From 9b6f7e978c90f4b8443bed7bfbeae0bf94cd6a58 Mon Sep 17 00:00:00 2001 From: Anton Kosiakov Date: Sun, 14 Jan 2018 17:51:20 +0100 Subject: [PATCH] [monaco] fix Microsoft/monaco-editor#642: sync CompletionItemProvider api --- .../standalone/browser/standaloneLanguages.ts | 16 +++++++++++++++- src/vs/monaco.d.ts | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index 5c5b72caa39f9..67d2f59356532 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -525,6 +525,18 @@ export interface CompletionItem { * line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~ */ textEdit?: model.ISingleEditOperation; + /** + * An optional array of additional text edits that are applied when + * selecting this completion. Edits must not overlap with the main edit + * nor with themselves. + */ + additionalTextEdits?: model.ISingleEditOperation[]; + /** + * An optional set of characters that when pressed while this completion is active will accept it first and + * then type that character. *Note* that all commit characters should have `length=1` and that superfluous + * characters will be ignored. + */ + commitCharacters?: string[]; } /** * Represents a collection of [completion items](#CompletionItem) to be presented @@ -634,7 +646,9 @@ class SuggestAdapter { command: item.command, sortText: item.sortText, filterText: item.filterText, - snippetType: 'internal' + snippetType: 'internal', + additionalTextEdits: item.additionalTextEdits, + commitCharacters: item.commitCharacters }; let editRange = item.textEdit ? item.textEdit.range : item.range; if (editRange) { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 81d3e99523b52..3d7bcb4b0575b 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -4166,6 +4166,18 @@ declare module monaco.languages { * line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~ */ textEdit?: editor.ISingleEditOperation; + /** + * An optional array of additional text edits that are applied when + * selecting this completion. Edits must not overlap with the main edit + * nor with themselves. + */ + additionalTextEdits?: editor.ISingleEditOperation[]; + /** + * An optional set of characters that when pressed while this completion is active will accept it first and + * then type that character. *Note* that all commit characters should have `length=1` and that superfluous + * characters will be ignored. + */ + commitCharacters?: string[]; } /**