Chat history "persistence"#59
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in mechanism to keep the chat buffer alive when closing/toggling the ECA sidebar, plus a new EcaChatClear command to explicitly reset the chat content.
Changes:
- Introduces
behavior.preserve_chat_history(defaultfalse) to preserve chat content across sidebar close/reopen. - Updates sidebar window/buffer lifecycle to reuse the existing chat buffer when preservation is enabled.
- Adds
:EcaChatClearand corresponding tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
lua/eca/config.lua |
Adds the preserve_chat_history config default. |
lua/eca/sidebar.lua |
Implements window-only closing and chat buffer reuse; adjusts refresh behavior when preservation is enabled. |
lua/eca/commands.lua |
Registers :EcaChatClear to clear the chat buffer and reset welcome flags. |
tests/test_chat_clear.lua |
Adds test coverage for :EcaChatClear across open/closed sidebar states and preservation modes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
FYI @joaopluigi |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “preserve chat history” mode so toggling/closing the sidebar keeps the underlying chat buffer alive, and introduces an :EcaChatClear command to explicitly clear the chat.
Changes:
- Add
behavior.preserve_chat_history(defaultfalse) to optionally keep the chat buffer across sidebar close/open cycles. - Update sidebar close/open logic to retain and reuse the existing chat buffer when preservation is enabled.
- Add
:EcaChatClearplus a new MiniTest suite covering clear behavior and persistence/leak checks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lua/eca/sidebar.lua |
Implements “windows-only” close behavior and chat-buffer reuse when preserve_chat_history is enabled. |
lua/eca/config.lua |
Adds the preserve_chat_history default config flag. |
lua/eca/commands.lua |
Registers :EcaChatClear to clear the chat buffer and adjust welcome flags. |
tests/test_chat_clear.lua |
New tests for :EcaChatClear and buffer persistence across toggles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Adds an opt-in mechanism to keep the chat buffer alive across sidebar close/open cycles, preventing conversation loss when the sidebar is toggled for screen space, and introduces a command to explicitly clear the chat content.
Changes:
- Add
behavior.preserve_chat_historyconfig option (defaultfalse) to preserve the chat buffer across sidebar toggles. - Update sidebar close/open container lifecycle to reuse an existing chat buffer when preservation is enabled.
- Add
:EcaChatClearcommand plus a new MiniTest suite covering clear/persistence behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lua/eca/sidebar.lua |
Implements window-only close for chat when preservation is enabled; reuses existing chat buffer on open; adds clear_chat() helper. |
lua/eca/config.lua |
Adds preserve_chat_history default config flag. |
lua/eca/commands.lua |
Registers new :EcaChatClear user command. |
tests/test_chat_clear.lua |
New tests validating EcaChatClear behavior and preservation toggle behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@tamercuba let me know when this is ready, @joaopluigi is AFK for some time, but I can merge this when ready |
|
@ericdallo Im still figuring out the copilot comments. Specially the last "batch" of comments, still dont know exactly what to do. But ty for your attention |
There was a problem hiding this comment.
Pull request overview
Adds optional chat buffer persistence across sidebar close/open cycles, so toggling the UI doesn’t wipe an in-progress conversation when behavior.preserve_chat_history = true. Also introduces an explicit command to clear the chat buffer and accompanying MiniTest coverage.
Changes:
- Add
behavior.preserve_chat_historyconfig flag (defaultfalse) to preserve the chat buffer across sidebar toggles. - Update sidebar close/open container lifecycle to reuse an existing chat buffer when preservation is enabled.
- Add
:EcaChatClearuser command and a new test suite covering clear + preservation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lua/eca/sidebar.lua |
Implements “windows-only” close for chat when preserving history; reuses preserved chat buffer on reopen; adds clear_chat() state reset + buffer wipe. |
lua/eca/commands.lua |
Registers the new :EcaChatClear user command that calls sidebar:clear_chat(). |
lua/eca/config.lua |
Adds the preserve_chat_history config default under behavior. |
tests/test_chat_clear.lua |
Adds MiniTest coverage for EcaChatClear behavior and the preserve toggle lifecycle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@ericdallo seems that the rigorous chat jippidy is now satisfied with my new feature. Can you please run the CI pipeline? I think this is ready for a human review rn :D ps: there is a lack of documentation about what I developed here, im aware. Idk if its better to wait to merge this PR and then i open another one just to update the docs, or if we should merge everything in thie PR. Let me know about your opinion about this :) |
|
@tamercuba no problem! We can open other PRs. I'm looking for more people to help with eca-nvim so let me know if you have interest in improving it more |
|
@ericdallo thank you for the invitation, and thank you for continuing this and other projects; its really great work! But for now, Im not interested in contributing any further |
Problem
Closing or toggling the sidebar to reclaim screen space for code, a REPL buffer, or any other window would wipe the ongoing conversation. Reopening the sidebar always started fresh, which made the toggle gesture impractical during an active session.
Solution
When
behavior.preserve_chat_history = true, closing the sidebar only closes the windows. The underlying chat buffer is kept alive and reattached the next time the sidebar opens, so the conversation continues exactly where it was left off.A new
EcaChatClearcommand is provided to explicitly reset the chat when needed.The flag defaults to
falseto preserve the existing behavior for anyone updating the plugin. If the maintainers prefers making persistence the default and dropping the flag, that change is straightforward.Config
Before / After