diff options
author | Henning Dieterichs <notify.henning.dieterichs@live.de> | 2022-07-27 18:06:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 18:06:14 +0300 |
commit | d391f2c1ffcd270bce8c85d810e4b8a0f3822fa3 (patch) | |
tree | 77d24ba5a78255db1720af0c1df2e8b1409754b9 /src/vs | |
parent | dc6c57bdcea52db37f7a9ecf94b79a375ddb2ec7 (diff) | |
parent | dd807977b119e930caef3526031e9a2fdaaac4e5 (diff) |
Merge pull request #156313 from juihanamshet1/modifying-bracket-completion-range
If the brackets are removed, reduce the range. If the brackets are added, increase the range.
Diffstat (limited to 'src/vs')
-rw-r--r-- | src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts b/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts index b60a6dec142..02104cfe890 100644 --- a/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts +++ b/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts @@ -699,7 +699,7 @@ export async function provideInlineCompletions( } for (const item of completions.items) { - const range = item.range ? Range.lift(item.range) : defaultReplaceRange; + let range = item.range ? Range.lift(item.range) : defaultReplaceRange; if (range.startLineNumber !== range.endLineNumber) { // Ignore invalid ranges. @@ -724,6 +724,12 @@ export async function provideInlineCompletions( model, languageConfigurationService ); + + // Modify range depending on if brackets are added or removed + const diff = insertText.length - item.insertText.length; + if (diff !== 0) { + range = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff); + } } snippetInfo = undefined; |