Skip to content

Feature/overide default window config on open chat buffer #1678

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Jufralice
Copy link
Contributor

@Jufralice Jufralice commented Jun 20, 2025

Description

Allow passing display options to chat and toggle commands.

We can now pass options to CodeCompanion.chat or CodeCompanion.toggle to override the default window configuration
('config.display.chat.window') such as window dimensions or layout, to dynamically control the appearance and behavior of the chat buffer.

Related Discussion(s)

this was requested in this #1676 discussion

Checklist

  • I've read the contributing guidelines and have adhered to them in this PR
  • I've updated CodeCompanion.has in the init.lua file for my new feature
  • I've added test coverage for this fix/feature
  • I've updated the README and/or relevant docs pages
  • I've run make all to ensure docs are generated, tests pass and my formatting is applied

Adds an 'opts' parameter to CodeCompanion.chat, CodeCompanion.toggle,
and the internal Chat.new constructor. This enables users to pass
display-related options, such as window dimensions or layout,
dynamically to control the appearance and behavior of the chat buffer.

The 'opts.window' table can now be used to override the default
'config.display.chat.window' settings for 'open' and 'hide' operations.
refactor(chat-ui): persist window display options

The `ChatUI` component now stores window display configuration internally on the UI instance (`self.window`). (only when dynamically added)
This allows `ChatUI:hide()` to retrieve the correct layout settings without needing an `opts` parameter.
The `ChatUI:open()` method now retrieves the last used window configuration from `self.window` if available.

And most importantly: Ensures window layout consistency is maintained when switching between chat buffers.
@olimorris
Copy link
Owner

This looks like a great PR. I'm away right now so will test this out next week some time.

Apply documentation changes like proposed by Olimorris:
Rewords and simplifies the explanation for overriding chat buffer window settings in the documentation, replacing lengthy TIP blocks with a concise sentence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants