diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index e339147f..cb2c63e6 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -274,4 +274,8 @@ https://github.com/gorbit99/codewindow.nvim - [img-clip.nvim]'s configuration now has it's own DAG entry, separate from image-nvim. +[alv-around](https://github.com/alv-around): + +- Fix `vim.assistant.codecompanion-nvim` lazy loading with [blink-cmp] + diff --git a/modules/plugins/assistant/codecompanion/config.nix b/modules/plugins/assistant/codecompanion/config.nix index fa863b74..6fbb60fb 100644 --- a/modules/plugins/assistant/codecompanion/config.nix +++ b/modules/plugins/assistant/codecompanion/config.nix @@ -18,6 +18,18 @@ in { package = "codecompanion-nvim"; setupModule = "codecompanion"; inherit (cfg) setupOpts; + + # Register commands with lz.n so Neovim recognizes them immediately + cmd = [ + "CodeCompanion" + "CodeCompanionChat" + "CodeCompanionActions" + "CodeCompanionCmd" + ]; + + # Ensure the plugin loads when entering Insert/Cmdline mode + # so the module is ready when blink.cmp requests it + event = ["InsertEnter" "CmdlineEnter"]; }; }; @@ -33,9 +45,20 @@ in { ]; }; - autocomplete.nvim-cmp = { - sources = {codecompanion-nvim = "[codecompanion]";}; - sourcePlugins = ["codecompanion-nvim"]; + autocomplete = { + nvim-cmp = { + sources = {codecompanion-nvim = "[codecompanion]";}; + sourcePlugins = ["codecompanion-nvim"]; + }; + blink-cmp = { + setupOpts.sources = { + default = ["codecompanion"]; + providers.codecompanion = { + name = "CodeCompanion"; + module = "codecompanion.providers.completion.blink"; + }; + }; + }; }; }; };