From 784a7fa62c61a041bb236462cb615bba7aaf4a5e Mon Sep 17 00:00:00 2001 From: y00228954 Date: Tue, 13 Aug 2019 18:10:28 +0800 Subject: [PATCH] fix snippet suggestion does not replace the input string --- packages/monaco/src/browser/monaco-snippet-suggest-provider.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/monaco/src/browser/monaco-snippet-suggest-provider.ts b/packages/monaco/src/browser/monaco-snippet-suggest-provider.ts index eac9538cca13e..c8e8073e6c5b1 100644 --- a/packages/monaco/src/browser/monaco-snippet-suggest-provider.ts +++ b/packages/monaco/src/browser/monaco-snippet-suggest-provider.ts @@ -35,6 +35,8 @@ export class MonacoSnippetSuggestProvider implements monaco.modes.ISuggestSuppor } resolveCompletionItem(_: monaco.editor.ITextModel, __: monaco.Position, item: monaco.modes.ISuggestion): monaco.modes.ISuggestion { + const word = _.getWordAtPosition(__); + item.overwriteBefore = word.endColumn - word.startColumn; return item instanceof MonacoSnippetSuggestion ? item.resolve() : item; }