feat: Add configurable buffer names for Agentic panels#187
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds per-window buffer name customization via a new windows..buffer_name option (accepts a string or a function(header_parts) -> string|nil). Introduces a resolver that pcall-calls functions, validates return types, logs errors, and falls back to the header title when needed. set_buffer_name and render_header now use the resolved name. Typed config alias and integration tests plus README/doc updates were added. Sequence Diagram(s)sequenceDiagram
participant Renderer as WindowDecoration
participant Config as Config (windows.<panel>.buffer_name)
participant UserFn as User-defined Function
participant Logger as Logger
participant Buffer as Buffer/Tab
Renderer->>Config: read buffer_name
alt buffer_name is string
Config-->>Renderer: string
else buffer_name is function
Renderer->>UserFn: call with header_parts (pcall)
alt UserFn returns string
UserFn-->>Renderer: string
else UserFn returns nil or non-string
UserFn-->>Renderer: nil
else UserFn errors
UserFn-->>Logger: error
Logger-->>Renderer: notify
Renderer-->>Config: use fallback
end
else buffer_name nil/absent
Config-->>Renderer: nil (use fallback)
end
Renderer->>Buffer: set buffer name (resolved or fallback) and apply "(Tab N)" suffix
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lua/agentic/config_default.lua`:
- Around line 430-432: Remove the duplicate class annotation by deleting the
repeated "@class agentic.UserConfig.Settings" doc comment in the block that
defines settings (the table assigned to settings = { ... }), leaving the
original class annotation defined earlier intact; ensure only the earlier
declaration remains so the settings table uses the existing type without
re-declaring the class.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fcaaf007-9354-43ec-845c-8c992d6aa99e
📒 Files selected for processing (4)
README.mdlua/agentic/config_default.lualua/agentic/ui/window_decoration.luatests/integration/test_buffer_naming.lua
b588907 to
9789031
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lua/agentic/config_default.lua`:
- Line 435: The file ends with "return ConfigDefault" but lacks a trailing
newline; open the file containing the ConfigDefault return statement and add a
single newline character after the final "return ConfigDefault" so the file ends
with a newline (this satisfies Stylua/formatter expectations).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 577b63e4-da2b-4480-a3ef-413c8652e75d
📒 Files selected for processing (4)
README.mdlua/agentic/config_default.lualua/agentic/ui/window_decoration.luatests/integration/test_buffer_naming.lua
9789031 to
ff44a86
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/integration/test_buffer_naming.lua`:
- Around line 81-120: Add three new integration tests in
tests/integration/test_buffer_naming.lua covering buffer_name resolver edge
cases: (1) a windows.chat.buffer_name function that throws — call
require("agentic").setup with that function, toggle the panel, then assert
get_panel_basename("chat") falls back to the header title (starts with "
Agentic Chat"); (2) a buffer_name function that returns a non-string (e.g., nil
or number) — toggle and assert get_panel_basename("chat") falls back to the
header title; (3) two panels in the same tab configured with the same explicit
buffer_name string — open both panels (use require("agentic").setup with two
window configs or toggle them sequentially), then assert both
get_panel_basename(...) values start with that explicit name and are not
identical (ensure uniqueness to avoid rename collisions). Use the existing
patterns around require("agentic").setup, require("agentic").toggle,
child.flush(), and get_panel_basename to match the other tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2c3fcbe4-acdd-4423-9522-df832e66d7dc
📒 Files selected for processing (4)
README.mdlua/agentic/config_default.lualua/agentic/ui/window_decoration.luatests/integration/test_buffer_naming.lua
carlos-algms
left a comment
There was a problem hiding this comment.
Hey @chancez Thank you again for another contribution.
have you tried using neovim's native title handing?
opt.title = true
opt.titlelen = 0 -- do not shorten title
opt.titlestring = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")I'm concerned that it seems off-topic for this plugin to handle the terminal title.
I'm aware of the title setting, but the I like the behavior of using my active buffer name as my window title. Even I were to modify my This change is specifically for buffer names, but part of the outcome is how that impacts my terminal title. That being said, there's many other reasons someone may want to customize the buffer name besides my primary motivation. For example, if you have multiple tabs open each with a different agentic session, you may want to add the model name, or the session "name" into the buffer name to make it easier to distinguish between different sessions for example. |
ff44a86 to
06c6b4b
Compare
06c6b4b to
8583d16
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@doc/agentic.txt`:
- Line 290: Replace the plain text reference "See agentic-config-headers." with
a vimdoc cross-reference using the pipe-delimited symbol format: change the
string to use |agentic-config-headers| so help navigation picks up the section;
locate the occurrence near the "See agentic-config-headers." line and update it
to "See |agentic-config-headers|."
In `@lua/agentic/ui/window_decoration.lua`:
- Around line 215-238: The buffer_name function handler currently treats a nil
return from the user-provided buffer_name as an immediate fallback (returning
fallback), leaving stale/empty names; change the behavior so that when
pcall(buffer_name, header_parts) returns ok and result == nil you return
header_text (the header name) instead of fallback, and keep the existing
type-check/log path for non-string results; apply the same change to the
duplicate block handling buffer_name at the other location (the similar code
around the second occurrence referenced in the review).
In `@README.md`:
- Around line 225-233: The MD028 lint error is caused by an unquoted blank line
breaking blockquote continuity between the "[!WARNING]" and "[!NOTE]" blocks;
fix by ensuring any blank separator lines remain inside the blockquote markers
so the entire quoted section stays continuous — update the README block
containing "[!WARNING]" and "[!NOTE]" so the blank line is prefixed with the
blockquote marker (keeping the separator quoted) rather than leaving an unquoted
empty line.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 32570bd0-08c2-4725-b9e6-cdd7004b5028
📒 Files selected for processing (5)
README.mddoc/agentic.txtlua/agentic/config_default.lualua/agentic/ui/window_decoration.luatests/integration/test_buffer_naming.lua
8583d16 to
57a47c8
Compare
Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
57a47c8 to
08d07f0
Compare
I've had this locally for a while. The main motivation for me is that I'd like to change the buffer names because the buffer name is what's displayed in my terminal window/tab title. This includes the text like
<S-Tab>: change mode, and such, which just clutters my terminal tabs. But I can see other uses when combined with hooks to customize the buffer name to something else like the model used, or the session "name", etc.