From 2e008a6fa29bcd6d2659c7265ee20b1200de95ae Mon Sep 17 00:00:00 2001 From: Cubxity <27609129+Cubxity@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:57:01 +0200 Subject: [PATCH] fix: autocomplete on windows (#27) Autocomplete on Windows didn't work due to improper path handling. --- src-tauri/src/ipc/commands/typst.rs | 2 +- src/lib/editor/completion.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/ipc/commands/typst.rs b/src-tauri/src/ipc/commands/typst.rs index 0be17f2..c71932b 100644 --- a/src-tauri/src/ipc/commands/typst.rs +++ b/src-tauri/src/ipc/commands/typst.rs @@ -203,7 +203,7 @@ pub async fn typst_autocomplete( offset: usize, explicit: bool, ) -> Result { - let (project, path) = project_path(&window, &project_manager, path)?; + let project = project(&window, &project_manager)?; let mut world = project.world.lock().unwrap(); let offset = content diff --git a/src/lib/editor/completion.ts b/src/lib/editor/completion.ts index 95012a1..9ecb490 100644 --- a/src/lib/editor/completion.ts +++ b/src/lib/editor/completion.ts @@ -16,7 +16,7 @@ export class TypstCompletionProvider implements languages.CompletionItemProvider ): Promise { console.log("completing", position, context); const { offset: completionOffset, completions } = await autocomplete( - model.uri.path.substring(1), + model.uri.path, model.getValue(), model.getOffsetAt(position), context.triggerKind === CompletionTriggerKind.Invoke