chat: unify history in different editors#278846
Merged
connor4312 merged 2 commits intomainfrom Nov 21, 2025
Merged
Conversation
Previously history was read and updated individually by chat components, which could cause some history to get lost if multiple chat editors were open. This adds a ChatHistoryNavigator which is a view on the chat history. It reacts when new entries are appended, preserving the history position of other editors while allowing editor-local modifications via its 'overlay' (which is also used to keep the current in-progress edit when navigating back in history). Also brings back _getFilteredEntry which was lost in my earlier refactor. Refs #277318
74b7bc9 to
44ead28
Compare
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
dmitrivMS
previously approved these changes
Nov 21, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors chat history management to centralize it in a unified service, addressing issues where history could be lost when multiple chat editors were open. Previously, each chat component managed its own history independently, leading to synchronization problems.
Key changes:
- Introduced
ChatHistoryNavigatoras a view on the centralized chat history with support for editor-local modifications via an overlay mechanism - Migrated from
HistoryNavigator2to a custom navigation implementation that supports concurrent navigators - Added comprehensive test coverage for both
ChatWidgetHistoryServiceandChatHistoryNavigator
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/chatWidgetHistoryService.test.ts | Comprehensive test suite for the new history service and navigator with 413 lines covering navigation, overlay, concurrent navigators, and history limits |
| src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.ts | Added ChatHistoryNavigator class and refactored ChatWidgetHistoryService to use events and lazy persistence via onWillSaveState |
| src/vs/workbench/contrib/chat/browser/chatInputPart.ts | Simplified history management by replacing direct HistoryNavigator2 usage with ChatHistoryNavigator, removed manual saveState calls, restored _getFilteredEntry to filter image values from history |
| src/vs/workbench/contrib/chat/browser/chatWidget.ts | Removed now-unnecessary saveState calls since history is auto-saved via the service's event handler |
src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.ts
Outdated
Show resolved
Hide resolved
roblourens
previously approved these changes
Nov 21, 2025
2db1638
21 tasks
dmitrivMS
approved these changes
Nov 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously history was read and updated individually by chat components,
which could cause some history to get lost if multiple chat editors
were open.
This adds a ChatHistoryNavigator which is a view on the chat history.
It reacts when new entries are appended, preserving the history position
of other editors while allowing editor-local modifications via its
'overlay' (which is also used to keep the current in-progress edit
when navigating back in history).
Also brings back _getFilteredEntry which was lost in my earlier refactor.
Refs #277318
cc @TylerLeonhardt please let me know if you see any more issues
after this is in :)