From 661eba3ae9e399845ca2e2f45d95eb5cdd2c5137 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Thu, 27 Feb 2025 17:08:49 -0800 Subject: [PATCH] fix selection state bug --- .../contrib/void/browser/chatThreadService.ts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/chatThreadService.ts b/src/vs/workbench/contrib/void/browser/chatThreadService.ts index 98f98f8e..3a9f4156 100644 --- a/src/vs/workbench/contrib/void/browser/chatThreadService.ts +++ b/src/vs/workbench/contrib/void/browser/chatThreadService.ts @@ -201,6 +201,23 @@ class ChatThreadService extends Disposable implements IChatThreadService { ) { super() + + setInterval(() => { + const thread = this.getCurrentThread() + if (!thread) return + + // print out all staging selections for all messages + for (const message of thread.messages) { + if (message.role === 'user' && message.state.stagingSelections.length > 0) { + console.log('Message staging selections:', message.state.stagingSelections) + } + } + // also print thread-level staging selections + if (thread.state.stagingSelections.length > 0) { + console.log('Thread staging selections:', thread.state.stagingSelections) + } + }, 1000) + const oldVersionNum = this._storageService.get(THREAD_VERSION_KEY, StorageScope.APPLICATION) @@ -345,8 +362,8 @@ class ChatThreadService extends Disposable implements IChatThreadService { } // get prev and curr selections before clearing the message - const prevSelns = this._getSelectionsUpToMessageIdx(messageIdx) - const currSelns = thread.messages[messageIdx].selections || [] + const prevSelns = this._getSelectionsUpToMessageIdx(messageIdx) // selections for previous messages + const currSelns = thread.messages[messageIdx].state.stagingSelections || [] // staging selections for the edited message // clear messages up to the index const slicedMessages = thread.messages.slice(0, messageIdx)