Skip to content

feat: label ACP providers in provider switch - #3266

Merged
teto merged 4 commits into
avante-corp:mainfrom
Tiancheng-Xu:oss/avante-acp-provider-label-3257
Oct 4, 2026
Merged

teto merged 4 commits into
avante-corp:mainfrom
Tiancheng-Xu:oss/avante-acp-provider-label-3257

Conversation

@Tiancheng-Xu

@Tiancheng-Xu Tiancheng-Xu commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Mark ACP providers with (ACP) in :AvanteSwitchProvider so their type is clear in mixed provider lists.
  • Keep regular provider labels and selected provider identifiers unchanged.
  • Keep formatting local to the picker's format_item callback; no new provider API or committed test changes.

Verification

  • Fresh local Neovim picker regression: 1 passed, covering ACP labels, regular labels, and the original provider name passed to selection. The same check fails on the unmodified base.
  • stylua --check --config-path stylua.toml plugin/avante.lua tests/providers/init_spec.lua passed.
  • luac -p passed for the picker and restored provider test fixture.
  • The added picker spec was removed from this PR and the provider fixture restored to the base version, as requested in review. The production picker code is unchanged from the previously reviewed commit.
  • Full make luatest could not run locally: scripts/run-luatest.sh stops because nlua is unavailable.
  • make lua-typecheck was not run because lua-language-server is unavailable locally.
  • Upstream checks must be verified on the new head; previous-head results are not claimed as current-head validation.

Closes #3257

@teto

teto commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Tested and it worked fine. Any comment on the formatting @cybaol ?

@cybaol

cybaol commented Sep 29, 2026

Copy link
Copy Markdown
Member

@teto: The current (ACP) suffix looks good to me. It is clear, concise, and works consistently across different vim.ui.select implementations.

@teto

teto commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

@Tiancheng-Xu you can run make docgen once you have vimcats installed to regen the doc.

@Tiancheng-Xu

Copy link
Copy Markdown
Contributor Author

Thanks — I installed the repo-pinned vimcats version and ran make docgen; it completes without changing doc/avante.txt, and git diff --check passes. The updated Lua CI, pre-commit, and Vimdoc runs are currently gated as action_required, so they have not executed on this commit yet.

@cybaol

cybaol commented Sep 29, 2026

Copy link
Copy Markdown
Member

Since this change only affects UI presentation, it does not need to introduce a new public API in avante.providers. Exposing format_provider_name also makes this UI-specific formatting part of the documented API surface.

Could we keep the change local to vim.ui.select instead?
Like this:

format_item = function(provider_name)
  if Config.acp_providers[provider_name] then
    return provider_name .. " (ACP)"
  end
  return provider_name
end,

@Tiancheng-Xu

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out — agreed, this is UI-only, so a provider-level API is unnecessary. I moved the suffix formatting into the picker’s format_item callback, removed the exported helper and its generated vimdoc, and added a focused regression test for the label while confirming selection still passes the original provider name.

I also updated the verification notes. The focused Neovim check, Lua syntax check, Stylua check, and git diff --check pass. I could not run the full make luatest locally because nlua is missing and the temporary LuaRocks download was unreachable.

@teto

teto commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Could we keep the change local to vim.ui.select instead?

good idea

I could not run the full make luatest locally because nlua is missing and the temporary LuaRocks download was unreachable.

If you are on linux, you can install nix https://nixos.org/ and dependencies are cached so even if primary source doesn't work, there it might.

Any reason it is still a draft ? I would like to merge it (though I am still unsure about merging AI-generated tests for non-crucial behaviors).

@Tiancheng-Xu
Tiancheng-Xu marked this pull request as ready for review October 4, 2026 08:14
Copilot AI balanced review requested due to automatic review settings October 4, 2026 08:14
@Tiancheng-Xu

Copy link
Copy Markdown
Contributor Author

Moved this out of draft. Linux/macOS unit tests, the Linux/macOS/Windows library builds, and pre-commit all passed on 26b35b6. The formatting stays local to the picker, as requested.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The change is a small, display-only picker label that preserves selection behavior, backed by a focused test, with no correctness or nil-safety concerns.

Review effort: Balanced
Findings: None

What changed in this PR

This PR improves provider discoverability in :AvanteSwitchProvider by appending (ACP) to ACP provider entries in the selection picker, addressing issue #3257. The labeling is kept local to the picker via vim.ui.select's format_item, so the underlying provider names passed to switch_provider remain unchanged and no new provider API is exposed.

Changes:

  • Add a format_item callback in the AvanteSwitchProvider picker to suffix ACP providers with (ACP) while leaving regular providers unchanged.
  • Add a new tests/plugin_spec.lua verifying the picker label formatting and that selection still switches to the correct (unformatted) provider name.
  • Extend tests/providers/init_spec.lua setup with an acp_providers entry.
File Description
plugin/​avante.lua Adds display-only format_item to label ACP providers (ACP) in the switch-provider picker.
tests/​plugin_spec.lua New test covering picker label formatting and correct provider selection via mocked modules.
tests/​providers/​init_spec.lua Adds an acp_providers entry to the provider test config.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cybaol

cybaol commented Oct 4, 2026

Copy link
Copy Markdown
Member

Remove AI generated tests would be
better. because it's non-crucial part.

@Tiancheng-Xu

Copy link
Copy Markdown
Contributor Author

Removed the added picker spec and reverted the ACP test fixture in a7088973e7aa263e4049804d12b0c2ca1b103ad3. The PR now changes only plugin/avante.lua (7 added lines, 1 removed), with the suffix formatting still local to vim.ui.select.

I retained a local-only picker check: ACP and regular labels, plus passing the original provider name on selection, all pass. The same check fails on the unmodified base. Formatting and Lua syntax checks pass. The updated verification notes keep full-suite/typecheck limitations explicit; the new head still needs its upstream checks.

@teto

teto commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

thanks for the follow up and thanks for the review @cybaol ;)

@teto
teto merged commit b6c02d8 into avante-corp:main Oct 4, 2026
8 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.

make it more obvious whether we are using an ACP provider

4 participants