-
-
Notifications
You must be signed in to change notification settings - Fork 292
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Pre-submission checklist
- I have read the documentation
- I have updated the plugin and all dependencies to the latest versions
- I have searched for existing issues and discussions
- My issue is not a minor or cosmetic quirk (e.g., formatting, spacing, or other non-functional details)
Neovim version (nvim -v)
0.12.0 commit 3c601d02dc
Operating system/version
Arch Linux x86_64
Adapter and model
gemini_cli
Describe the bug
When I set display > chat > show_settings = true
, strategies > chat > adapter = "gemini_cli"
and open a sidebar chat window, It throws error message below:
Lua :command callback: ...vim/lazy/codecompanion.nvim/lua/codecompanion/schema.lua:122: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
...vim/lazy/codecompanion.nvim/lua/codecompanion/schema.lua:122: in function 'get_ordered_keys'
...anion.nvim/lua/codecompanion/strategies/chat/ui/init.lua:322: in function 'render'
...ompanion.nvim/lua/codecompanion/strategies/chat/init.lua:663: in function 'chat'
...m/lazy/codecompanion.nvim/lua/codecompanion/commands.lua:131: in function <...m/lazy/codecompanion.nvim/lua/codecompanion/commands.lua:130>
Steps to reproduce
- Set
display > chat > show_settings = true
andstrategies > chat > adapter = "gemini_cli"
- Open Nvim, then run command
:CodeCompanionChat
- The error shows up, sidebar chat window not working.
Expected behavior
Sidebar chat window shows up without error.
Screenshots or recordings (optional)
codecompanion_error.mp4
minimal.lua file
---@diagnostic disable: missing-fields
--[[
NOTE: Set the config path to enable the copilot adapter to work.
It will search the following paths for a token:
- "$CODECOMPANION_TOKEN_PATH/github-copilot/hosts.json"
- "$CODECOMPANION_TOKEN_PATH/github-copilot/apps.json"
--]]
vim.env["CODECOMPANION_TOKEN_PATH"] = vim.fn.expand("~/.config")
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
-- Your CodeCompanion setup
local plugins = {
{
"olimorris/codecompanion.nvim",
dependencies = {
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
{ "nvim-lua/plenary.nvim" },
-- Test with blink.cmp (delete if not required)
{
"saghen/blink.cmp",
lazy = false,
version = "*",
opts = {
keymap = {
preset = "enter",
["<S-Tab>"] = { "select_prev", "fallback" },
["<Tab>"] = { "select_next", "fallback" },
},
cmdline = { sources = { "cmdline" } },
sources = {
default = { "lsp", "path", "buffer", "codecompanion" },
},
},
},
-- Test with nvim-cmp
-- { "hrsh7th/nvim-cmp" },
},
opts = {
adapter = {
acp = {
gemini_cli = function()
return require("codecompanion.adapters").extend("gemini_cli", {
env = {
api_key = "GEMINI_API_KEY",
},
})
end,
},
},
display = {
chat = {
intro_message = "Welcome to CodeCompanion ✨!\n Press ? for options",
separator = "─", -- The separator between the different messages in the chat buffer
show_context = true, -- Show context (from slash commands and variables) in the chat buffer?
show_header_separator = false, -- Show header separators in the chat buffer? Set this to false if you're using an external markdown formatting plugin
show_settings = true, -- Show LLM settings at the top of the chat buffer?
show_token_count = true, -- Show the token count for each response?
show_tools_processing = true, -- Show the loading message when tools are being executed?
start_in_insert_mode = false, -- Open the chat buffer in insert mode?
},
},
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
strategies = {
--NOTE: Change the adapter as required
chat = { adapter = "gemini_cli" },
inline = { adapter = "gemini_cli" },
},
opts = {
log_level = "DEBUG",
},
},
},
}
-- Leaving this comment in to see if the issue author notices ;-)
-- This is so I can tell if they've really tested with their own minimal.lua file
require("lazy.minit").repro({ spec = plugins })
-- Setup Tree-sitter
local ts_status, treesitter = pcall(require, "nvim-treesitter.configs")
if ts_status then
treesitter.setup({
ensure_installed = { "lua", "markdown", "markdown_inline", "yaml", "diff" },
highlight = { enable = true },
})
end
-- Setup nvim-cmp
-- local cmp_status, cmp = pcall(require, "cmp")
-- if cmp_status then
-- cmp.setup({
-- mapping = cmp.mapping.preset.insert({
-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
-- ["<C-Space>"] = cmp.mapping.complete(),
-- ["<C-e>"] = cmp.mapping.abort(),
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
-- -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
-- }),
-- })
-- end
Log output (optional)
Don't see any codecompanion.log file.
Minimal reproduction confirmation
- Yes, I have tested and provided a
minimal.lua
file that reproduces the issue
Copilot
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working