diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue index 2e69401b38..855c3168ac 100644 --- a/apps/desktop/src/components/editor/QueryEditor.vue +++ b/apps/desktop/src/components/editor/QueryEditor.vue @@ -868,7 +868,11 @@ function completionOptionForItem(item: QueryCompletionItem) { if (typeof originalApply === "function") { originalApply(view, completionItem as never, from, to); } else { - view.dispatch({ changes: { from, to, insert: String(originalApply ?? item.label) } }); + const insert = String(originalApply ?? item.label); + view.dispatch({ + changes: { from, to, insert }, + selection: { anchor: from + insert.length }, + }); } }, }; @@ -881,7 +885,11 @@ function completionOptionForItem(item: QueryCompletionItem) { boost: item.boost, apply(view: EditorViewType, _completionItem: unknown, from: number, to: number) { record(); - view.dispatch({ changes: { from, to, insert: item.apply ?? item.label } }); + const insert = item.apply ?? item.label; + view.dispatch({ + changes: { from, to, insert }, + selection: { anchor: from + insert.length }, + }); }, }; }