From e6a1397c2055c0bcaa48eee2f373f56425b7fdbd Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sun, 10 Mar 2024 21:32:32 +0800 Subject: [PATCH] fix: shifted completion cursor --- crates/tinymist-query/src/completion.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/tinymist-query/src/completion.rs b/crates/tinymist-query/src/completion.rs index b6dadc4f..a8178045 100644 --- a/crates/tinymist-query/src/completion.rs +++ b/crates/tinymist-query/src/completion.rs @@ -16,9 +16,7 @@ impl CompletionRequest { ) -> Option { let doc = doc.as_deref(); let source = get_suitable_source_in_workspace(world, &self.path).ok()?; - let offset = lsp_to_typst::position(self.position, position_encoding, &source)?; - // the typst's cursor is 1-based, so we need to add 1 to the offset - let cursor = offset + 1; + let cursor = lsp_to_typst::position(self.position, position_encoding, &source)?; let (offset, completions) = typst_ide::autocomplete(world, doc, &source, cursor, self.explicit)?;