From cce2d40881a04cf081a1fd2777fef013480f29d9 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 4 Apr 2024 11:35:32 -0400 Subject: [PATCH] fix: Fix multi-range completions. Fixes #18 --- src/completionDecoration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/completionDecoration.ts b/src/completionDecoration.ts index cfcb0f0..2e24a5a 100644 --- a/src/completionDecoration.ts +++ b/src/completionDecoration.ts @@ -23,9 +23,9 @@ export const completionDecoration = StateField.define({ const decorations = Decoration.set( effect.value.suggestions.map((suggestion) => { const endGhostText = - suggestion.cursorPos + suggestion.displayText.length; + suggestion.startPos + suggestion.displayText.length; let range = ghostMark.range( - decorationOffset + suggestion.cursorPos, + decorationOffset + suggestion.startPos, decorationOffset + endGhostText, ); decorationOffset += suggestion.displayText.length;