Skip to content

feat: support disabling automatic triggering for file picker and slash commands#259

Merged
carlos-algms merged 2 commits into
carlos-algms:mainfrom
chancez:pr/chancez/completion_auto_trigger_toggle
Jun 8, 2026
Merged

feat: support disabling automatic triggering for file picker and slash commands#259
carlos-algms merged 2 commits into
carlos-algms:mainfrom
chancez:pr/chancez/completion_auto_trigger_toggle

Conversation

@chancez

@chancez chancez commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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_func which allows blink to work with existing omnifunc sources, so the only behavior change I've added is the ability to disable auto-triggering completion, leaving the rest of the omnifunc stuff untouched.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Linter diff in the way? Review this PR in Change Stack to focus on meaningful changes and expand context only when needed.

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds 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
Loading
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
Loading

Possibly related PRs

Poem

"I nibble configs in the night,
toggling triggers soft and light,
files sleep until I hop and scan,
slashes wait for my quiet command,
a rabbit's tweak keeps flow polite." 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, explaining the motivation for disabling auto-triggering and mentioning blink.cmp compatibility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding configuration options to disable automatic completion triggering for both file picker and slash commands.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b6529a4 and 113ffdb.

📒 Files selected for processing (4)
  • doc/agentic.txt
  • lua/agentic/acp/slash_commands.lua
  • lua/agentic/config_default.lua
  • lua/agentic/ui/file_picker.lua

Comment thread doc/agentic.txt Outdated
Comment thread lua/agentic/ui/file_picker.lua
@chancez chancez force-pushed the pr/chancez/completion_auto_trigger_toggle branch 2 times, most recently from eb8d96d to c5dac91 Compare June 2, 2026 15:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between eb8d96d and c5dac91.

📒 Files selected for processing (6)
  • doc/agentic.txt
  • lua/agentic/acp/slash_commands.lua
  • lua/agentic/acp/slash_commands.test.lua
  • lua/agentic/config_default.lua
  • lua/agentic/ui/file_picker.lua
  • lua/agentic/ui/file_picker.test.lua

Comment thread lua/agentic/acp/slash_commands.test.lua Outdated
Comment thread lua/agentic/ui/file_picker.test.lua Outdated
@chancez chancez force-pushed the pr/chancez/completion_auto_trigger_toggle branch from c5dac91 to ad9b635 Compare June 2, 2026 16:07

@carlos-algms carlos-algms left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else seems ok.

Comment thread lua/agentic/ui/file_picker.lua
@chancez chancez requested a review from carlos-algms June 5, 2026 15:43
@carlos-algms carlos-algms changed the title Support disabling automatic completion triggering for both file picker and slash commands feat: support disabling automatic triggering for file picker and slash commands Jun 6, 2026
@carlos-algms

Copy link
Copy Markdown
Owner

@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>
@chancez chancez force-pushed the pr/chancez/completion_auto_trigger_toggle branch from 0555d67 to 9afc1ed Compare June 8, 2026 17:18
@chancez

chancez commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@carlos-algms Updated. I also fixed a bug where the completion randomly stopped working because the FilePicker was being GCed. I fixed it by storing it on the session: 9afc1ed (this PR)

@carlos-algms carlos-algms merged commit ca7700b into carlos-algms:main Jun 8, 2026
10 checks passed
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.

2 participants