-
Notifications
You must be signed in to change notification settings - Fork 37.3k
fix: Latest input is not stored to the history when sending message to a new chat #282633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where the chat input history stack position was not being reset after starting a new chat session using the "Send to New Chat" action (Ctrl+Shift+Enter). The root cause was that when the input text was programmatically re-submitted to a cleared chat session, it wasn't being stored in the history, which prevented the history cursor from resetting to the end position.
Key Changes
- Added
forceStoreToHistoryoption toIChatAcceptInputOptionsinterface to allow forcing input storage in history - Modified the history storage logic to honor this new option even for programmatic queries
- Updated
SendToNewChatActionto use this option when re-submitting input to a new chat session
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/chat.ts | Added optional forceStoreToHistory property to IChatAcceptInputOptions interface |
| src/vs/workbench/contrib/chat/browser/chatWidget.ts | Updated _acceptInput to check forceStoreToHistory option when determining whether to store input in history |
| src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts | Modified SendToNewChatAction to pass forceStoreToHistory: true when re-submitting input to new chat |
The fix is well-targeted and follows the existing pattern. The ChatHistoryNavigator.append() method (lines 240-247 in chatWidgetHistoryService.ts) resets _currentIndex to the end of history, which solves the reported issue. The changes are minimal and don't affect other parts of the codebase.
connor4312
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the diagnosis and the PR! Couple quick tweaks docs + suggested property naming
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts
Outdated
Show resolved
Hide resolved
…eToHistory` Co-authored-by: Connor Peet <connor@peet.io>
connor4312
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
Looks like a formatting failure: |
Head branch was pushed to by a user without write access
|
Hm, looks like one still remains if you open the file in vscode you should be able to ctrl+shift+p > Format Document to apply formatting |
|
It should be ok now |
connor4312
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
fix #282498
Cause
#282498 (comment)
Change
I added an option
storeToHistoryto the interfaceIChatAcceptInputOptions, and set it totrueinSendToNewChatAction.run(). In this way, even if the message to be sent to new chat session is automatically inputted by the system, it will be stored into the history as expected.