File/buffer context does not get added/Copilot cannot see added context #1926
-
Pre-submission checklist
Neovim version (nvim -v)NVIM v0.12.0-dev-195+g82f08f33c1 PrefaceI searched the existing issues and did not find any that described my issue as far as I can tell. I have tried the minimal config, and the minimal config does work, so the issue is clearly somewhere in my configuration. I have also tried simplifying my config around all AI plugins as much as I can (and all plugins used by AI plugins, such as render-markdown.nvim) to no avail. For example I removed the Lazy Copilot and CopilotChat imports, removed VectorCode, etc, to get as close as possible to the minimal config with regard to my CodeCompanion config. My dotfiles for reference. I am using the default Copilot adapter and copilot.lua, and I am authenticated. I can use the chat without context and can copy/paste code into the chat buffer and Copilot can tell me about what I added, suggest changes/explain the code/etc. My IssueI cannot seem to add anything to context that actually is picked up. I have tried If using a url, it tries to answer, but clearly is not actually reading the url I provided. For example it can provide me information about CodeCompanion worked completely fine for a couple weeks, before this issue started. It started around the same time that my employer-provided Copilot seat ran out of requests, however my limit was increased and now with a new month, so that should not be an issue as of today and yesterday. Example chatsThis is with my config:
And this is with the
It does not seem to matter where I add my question relative to the Note that Other SymptomsI notice that after CodeCompanion responds, the I also notice that the log level seems to be ignored: I have tried changing the Added after initial posting: I also tried CopilotChat.nvim, and it works. I am successfully able to add my buffer(s), files, urls, etc to the context and ask Copilot questions about the contents. Lastly, I notice that in Thank you in advanceObviously I do not expect anyone to go through my config for me. It is based on LazyVim but with a fair bit of custom/non-standard stuff added. But as a simple overview of what I think are all the relevant plugins, I am using Telescope, Blink, Copilot.lua, render-markdown.nvim, VectorCode, and CodeCompanion. I would appreciate any help in narrowing down what in my config might be causing this issue. I really love CodeCompanion! It was wonderful for the duration that it was working, and I would love to get it working again. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
My advice would be to start from the minimal.lua I provide in the config and if that works, work back from that. Nothing has changed in CodeCompanion to alter this behaviour. |
Beta Was this translation helpful? Give feedback.
-
I've encountered this problem in recent days, and I'm not able to recover stably at the moment |
Beta Was this translation helpful? Give feedback.
-
I have the same problem and I have narrowed it down to an issue with the ---@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" },
{ "github/copilot.vim" },
{ "nvim-treesitter/nvim-treesitter-context" },
},
opts = {
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
strategies = {
--NOTE: Change the adapter as required
chat = { adapter = "copilot" },
inline = { adapter = "copilot" },
},
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 Example chat:
After the
But after entering a message and pressing enter, the context disappears:
|
Beta Was this translation helpful? Give feedback.
I have the same problem and I have narrowed it down to an issue with the
nvim-treesitter/nvim-treesitter-context
plugin. If I add that to the minimal config, context seems to stop working.