From b85ae49aaef74e513ef1c53597d630f3116fe268 Mon Sep 17 00:00:00 2001 From: jasg Date: Mon, 19 Jan 2026 20:47:23 -0800 Subject: [PATCH] assistant/codecompanion-nvim: allow adapter to be specified by name and model --- docs/manual/release-notes/rl-0.9.md | 4 +++ .../codecompanion/codecompanion-nvim.nix | 36 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 187a8b04..818f264c 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -301,4 +301,8 @@ https://github.com/gorbit99/codewindow.nvim - Fix `vim.formatter.conform-nvim.setupOpts.formatters` type for correct merging +[SmackleFunky](https://github.com/SmackleFunky): + +- Updated codecompanion-nvim adapters to allow specifying a model. + diff --git a/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix b/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix index 27603ad7..98916d4b 100644 --- a/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix +++ b/modules/plugins/assistant/codecompanion/codecompanion-nvim.nix @@ -1,6 +1,6 @@ {lib, ...}: let - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) int str enum nullOr attrs; + inherit (lib.options) mkOption mkEnableOption literalExpression; + inherit (lib.types) int str enum nullOr attrs either submodule; inherit (lib.nvim.types) mkPluginSetupOption luaInline; in { options.vim.assistant = { @@ -202,9 +202,23 @@ in { strategies = { chat = { adapter = mkOption { - type = nullOr str; default = null; description = "Adapter used for the chat strategy."; + type = nullOr (either str (submodule { + options = { + name = mkOption { + type = nullOr str; + default = null; + description = "Name of the Adapter"; + }; + + model = mkOption { + type = nullOr str; + default = null; + description = "Model used for Adapter."; + }; + }; + })); }; keymaps = mkOption { @@ -253,9 +267,23 @@ in { inline = { adapter = mkOption { - type = nullOr str; default = null; description = "Adapter used for the inline strategy."; + type = nullOr (either str (submodule { + options = { + name = mkOption { + type = nullOr str; + default = null; + description = "Name of the Adapter"; + }; + + model = mkOption { + type = nullOr str; + default = null; + description = "Model used for Adapter."; + }; + }; + })); }; variables = mkOption {