blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Dynamic registration of custom cmdline completion source with docs

Open ibhagwan opened this issue 11 months ago • 4 comments

Feature Description

Hi again @Saghen and ty for your hard work, you're a machine :-)

Background: when fzf-lua detects nvim-cmp cmdline completion it will register itself as a custom source with docs, this feature is quice nice as it allows the user to see the option they are about to use and it's potential values, etc.

This is how it looks like: image

image

Apologize in advacne if I missed anything in the docs, how would I go about the entire process of:

  • Registering a custom cmdline source (dynamically at runtime, without having it defined in blink's setup)
  • Adding docs to the custom source so those are displayed with blink

ibhagwan avatar Jan 03 '25 18:01 ibhagwan

Seems interesting! We have the add_provider method but the user would need to explicitly add the source to their cmdline list, so we need a couple things for this:

  • [ ] Ability to show documentation window in cmdline mode (shouldn't be difficult, just need to hook up the redrawing)
  • [x] Ability for plugins to enable a source outside of the user's config

saghen avatar Jan 03 '25 19:01 saghen

Ty @Saghen that would be amazing, no rush on this definitely in the “nice to have” category :)

ibhagwan avatar Jan 03 '25 19:01 ibhagwan

@Saghen I think it would be very useful to add and register a source at runtime without requiring manual user configuration, especially since some plugins—like Neorg—have their own way of loading and integrating with external plugins.

I’m currently working on integrating Neorg with Blink Completion, but due to some architectural conflicts between the two, it’s proving to be extremely difficult—if not nearly impossible—to get everything working smoothly.

std-enigma avatar Aug 22 '25 10:08 std-enigma

@std-enigma It's already possible to register your source dynamically and enable it for a specific filetype via: https://github.com/Saghen/blink.cmp/blob/main/lua/blink/cmp/init.lua#L381

saghen avatar Aug 28 '25 14:08 saghen