Closed SDGLBL closed 3 months ago
minimal.lua
local root = vim.fn.fnamemodify("./.repro", ":p") -- set stdpaths to use .repro for _, name in ipairs({ "config", "data", "state", "cache" }) do vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name end -- bootstrap lazy local lazypath = root .. "/plugins/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "--single-branch", "https://github.com/folke/lazy.nvim.git", lazypath, }) end vim.opt.runtimepath:prepend(lazypath) -- Your CodeCompanion setup local plugins = { { "olimorris/codecompanion.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "nvim-telescope/telescope.nvim", -- Optional { "grapp-dev/nui-components.nvim", dependencies = { "MunifTanjim/nui.nvim", }, }, { "stevearc/dressing.nvim", -- Optional: Improves the default Neovim UI opts = {}, }, { "folke/edgy.nvim", event = "VeryLazy", init = function() vim.opt.laststatus = 3 vim.opt.splitkeep = "screen" end, opts = { animate = { enabled = false, }, right = { { ft = "codecompanion", title = "Code Companion Chat", size = { width = 0.45 } }, }, }, }, }, config = function() vim.cmd([[cab cc CodeCompanion]]) vim.cmd([[cab ccb CodeCompanionWithBuffers]]) require("codecompanion").setup({ adapters = { openai = require("codecompanion.adapters").use("openai", { env = { api_key = "cmd:gpg --decrypt ~/.openai-api-key.gpg 2>/dev/null", }, url = os.getenv("OPENAI_API_BASE") .. "/chat/completions", schema = { model = { default = "gpt-4o", choices = { "gpt-4o", "gpt-4-turbo-preview", "gpt-4", "gpt-3.5-turbo", }, }, }, }), anthropic = require("codecompanion.adapters").use("anthropic", { env = { api_key = "cmd:gpg --decrypt ~/.openai-api-key.gpg 2>/dev/null", }, url = os.getenv("OPENAI_API_BASE") .. "/messages", schema = { model = { default = "claude-3-5-sonnet", }, }, }), }, strategies = { -- Change the adapters as required chat = { adapter = "openai", }, inline = { adapter = "openai", }, tool = { adapter = "openai", }, agent = { adapter = "openai", agents = { opts = { auto_submit_errors = false, auto_submit_success = true, }, }, }, }, opts = { log_level = "TRACE", }, }) end, }, } require("lazy").setup(plugins, { root = root .. "/plugins", }) -- setup treesitter local ok, treesitter = pcall(require, "nvim-treesitter.configs") if ok then treesitter.setup({ ensure_installed = "all", ignore_install = { "phpdoc" }, -- list of parser which cause issues or crashes highlight = { enable = true }, }) end
============================================================================== codecompanion: require("codecompanion.health").check()
codecompanion.nvim report ~
[TRACE] 2024-07-15 04:13:21 Opening selector [TRACE] 2024-07-15 04:13:23 Opening selector [TRACE] 2024-07-15 04:13:24 Context: { active_buffers = { { filetype = "lua", id = 2, name = "init.lua", path = "/Users/lijie/dotfiles/.config/nvim/init.lua" } }, bufnr = 2, buftype = "", cursor_pos = { 17, 19 }, end_col = 19, end_line = 17, filename = "/Users/lijie/dotfiles/.config/nvim/init.lua", filetype = "lua", is_normal = true, is_visual = false, lines = {}, mode = "n", start_col = 19, start_line = 17, winnr = 1000 } [TRACE] 2024-07-15 04:13:24 Strategy: Chat [ERROR] 2024-07-15 04:13:25 Could not parse the settings in the chat buffer
As image
Actions -> Prompts -> GenerateCommitGitMessage
Thanks for this can confirm this is a bug for me too, using Anthropic.
...and fixed.
I don't like the final fix...I have no idea why tree-sitter was freaking out at certain points.
Your
minimal.lua
configError messages
Health check output
============================================================================== codecompanion: require("codecompanion.health").check()
codecompanion.nvim report ~
Log output
[TRACE] 2024-07-15 04:13:21 Opening selector [TRACE] 2024-07-15 04:13:23 Opening selector [TRACE] 2024-07-15 04:13:24 Context: { active_buffers = { { filetype = "lua", id = 2, name = "init.lua", path = "/Users/lijie/dotfiles/.config/nvim/init.lua" } }, bufnr = 2, buftype = "", cursor_pos = { 17, 19 }, end_col = 19, end_line = 17, filename = "/Users/lijie/dotfiles/.config/nvim/init.lua", filetype = "lua", is_normal = true, is_visual = false, lines = {}, mode = "n", start_col = 19, start_line = 17, winnr = 1000 } [TRACE] 2024-07-15 04:13:24 Strategy: Chat [ERROR] 2024-07-15 04:13:25 Could not parse the settings in the chat buffer
Describe the bug
As image
Reproduce the bug
Actions -> Prompts -> GenerateCommitGitMessage
Final checks
minimal.lua
config file above and still get the issue