From 6a0eaa472c2b82477e01ed9c2bf688179b016d91 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 1 Aug 2025 10:37:14 -0700 Subject: [PATCH] refactor: move event to selection change manager --- .../vscode/src/autocomplete/GhostTextAcceptanceTracker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts b/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts index 30110a341..fbb4ac8ae 100644 --- a/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts +++ b/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts @@ -125,9 +125,13 @@ export class GhostTextAcceptanceTracker { manager.registerListener( "ghostTextTracker", async (e, state) => { + if (!state.document || !state.cursorPosition) { + return false; + } + const wasGhostTextAccepted = this.checkGhostTextWasAccepted( - e.textEditor.document, - e.selections[0].active, + state.document, + state.cursorPosition, ); if (wasGhostTextAccepted) {