feat: support disabling automatic triggering for file picker and slash commands#259
Conversation
|
Linter diff in the way? Review this PR in Change Stack to focus on meaningful changes and expand context only when needed. 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 user-configurable auto_trigger flags for file-picker and slash-commands completion, extends the config schema and defaults, and guards runtime setup so the TextChangedI autocmd is only registered when the corresponding auto_trigger is true. Tests and docs were added/updated to reflect the behavior. Sequence Diagram(s)sequenceDiagram
participant Config
participant FilePicker
participant VimAPI
Config->>FilePicker: FilePicker._setup_completion(bufnr) reads file_picker.auto_trigger
alt file_picker.auto_trigger == true
FilePicker->>VimAPI: nvim_create_autocmd("TextChangedI", ...)
else file_picker.auto_trigger == false
FilePicker-->>Config: return (skip autocmd)
end
sequenceDiagram
participant Config
participant SlashCommands
participant VimAPI
Config->>SlashCommands: SlashCommands.setup_completion(bufnr) reads slash_commands.auto_trigger
alt slash_commands.auto_trigger == true
SlashCommands->>VimAPI: nvim_create_autocmd("TextChangedI", ...)
else slash_commands.auto_trigger == false
SlashCommands-->>Config: return (skip autocmd)
end
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@doc/agentic.txt`:
- Around line 851-855: The inline comments on the vimdoc lines for the options
auto_trigger (both under the top-level block and under slash_commands) exceed
the 78-character vimdoc width; edit the doc/agentic.txt entries for auto_trigger
and slash_commands so each comment text is wrapped to 78 columns or less (break
long comments into multiple comment lines or move part of the explanation to a
new comment line) while preserving the meaning and the option names
(auto_trigger, slash_commands) and the existing boolean examples (auto_trigger =
true).
- Around line 851-855: Clarify that setting auto_trigger = false for the @ or
slash_commands sections only disables automatic popup, not manual completion;
update the doc text near the auto_trigger entries to add a short note stating
manual completion remains available (use <C-x><C-o> to trigger completion for @
and <C-x><C-u> to trigger completion for /) so readers do not assume the feature
is fully disabled (refer to the auto_trigger and slash_commands settings when
applying the change).
In `@lua/agentic/ui/file_picker.lua`:
- Around line 80-82: Test coverage missing for the TextChangedI auto-trigger:
add a unit test in lua/agentic/ui/file_picker.test.lua that asserts the
TextChangedI autocmd is registered only when Config.file_picker.auto_trigger is
true and not registered (or is removed/no-op) when false; specifically, exercise
the file_picker setup code that touches Config.file_picker.auto_trigger and
observe the Neovim autocmd state for "TextChangedI" (or the module's autocmd
registration function used in file_picker.lua) to verify the presence/absence of
the handler while keeping existing checks for omnifunc/iskeyword and
complete_func/_files behavior intact.
🪄 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: 9d44c4cd-1d99-4860-a479-bb9e97c06cfe
📒 Files selected for processing (4)
doc/agentic.txtlua/agentic/acp/slash_commands.lualua/agentic/config_default.lualua/agentic/ui/file_picker.lua
eb8d96d to
c5dac91
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lua/agentic/acp/slash_commands.test.lua`:
- Around line 329-331: The test creates ephemeral buffers inline with
vim.api.nvim_create_buf(false, true) when calling SlashCommands.setup_completion
without keeping a handle or deleting them; change the calls to first assign the
created buffer to a local variable (e.g., local buf =
vim.api.nvim_create_buf(false, true)), pass that variable into
SlashCommands.setup_completion, and after the assertion explicitly delete the
buffer using vim.api.nvim_buf_delete(buf, {}) to avoid resource leaks; apply the
same change for the other occurrence around lines 340-342.
In `@lua/agentic/ui/file_picker.test.lua`:
- Around line 236-237: The test creates unnamed scratch buffers inline which
aren't cleaned up; assign the result of vim.api.nvim_create_buf(false, true) to
a local variable (e.g., local buf = vim.api.nvim_create_buf(...)) when calling
FilePicker:new and after assertions call vim.api.nvim_buf_delete(buf, {force =
true}) to remove the buffer; do the same change for the other occurrence around
the textchangedi_call_count() assertion (lines referenced in the comment) so
each created buffer is explicitly deleted after the test.
🪄 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: 05914c7e-dfc8-4371-87c3-3cd219803cd6
📒 Files selected for processing (6)
doc/agentic.txtlua/agentic/acp/slash_commands.lualua/agentic/acp/slash_commands.test.lualua/agentic/config_default.lualua/agentic/ui/file_picker.lualua/agentic/ui/file_picker.test.lua
c5dac91 to
ad9b635
Compare
carlos-algms
left a comment
There was a problem hiding this comment.
Everything else seems ok.
|
@chancez Could you please add a very small example in the README.md about how you enabled blink-cmp auto-completion? There's the section "## Integration with other Plugins" Then we can merge 🫡 |
This allows manual completion to be triggered, and allows for external plugins to trigger completion without interference from Agentic's automatic triggers. Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
0555d67 to
9afc1ed
Compare
|
@carlos-algms Updated. I also fixed a bug where the completion randomly stopped working because the |
This allows manual completion to be triggered, and allows for external plugins to trigger completion without interference from Agentic's automatic triggers.
I've currently got this working with blink.cmp's
blink.cmp.sources.complete_funcwhich allows blink to work with existingomnifuncsources, so the only behavior change I've added is the ability to disable auto-triggering completion, leaving the rest of the omnifunc stuff untouched.