Closed benwoodward closed 1 year ago
Please check your node version
Please check your node version
:!node -v
v16.16.0
Press ENTER or type command to continue
Hey! I'm also having this issue, this is my node version:
:!node -v
v16.17.0
Press ENTER or type command to continue
I tried reverting to github/copilot.vim and that worked fine so I think the issue is on this end. This is my nvim -v
, everything is up to date via :PackerUpdate
:
NVIM v0.8.0-dev-1112-g6d557e324
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az152-47
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/share/nvim"
Run :checkhealth for more info
Please let me know if there is anything else I can provide! And thank you for your work on this great project :)
UPDATE: I resolved the issue for myself by rearranging items in my plugins.lua
and making sure everything was properly called. This in particular helped:
{
"hrsh7th/nvim-cmp",
requires = {
...
{
"zbirenbaum/copilot.lua",
config = function()
require("copilot").setup()
end,
},
{
"zbirenbaum/copilot-cmp",
after = { "copilot.lua" },
config = function()
require("copilot_cmp").setup()
end,
},
},
},
The main changes I made were no longer loading copilot.lua asynchronously (used to load it on entering Insert Mode per the README) and loading both plugins inside the "required" block for cmp. This was probably the ugliest way I could fix this so if there is a better way lmk! Hope this helps someone.
thanks @i13e! that fixed it.
my new config:
packages.lua
{
"https://github.com/hrsh7th/nvim-cmp",
config = function()
require "plugins.cmp"
end,
requires = {
"https://github.com/hrsh7th/cmp-nvim-lsp",
"https://github.com/hrsh7th/cmp-path",
"https://github.com/hrsh7th/cmp-buffer",
"https://github.com/tzachar/cmp-tabnine",
-- "hrsh7th/cmp-vsnip",
-- "hrsh7th/vim-vsnip",
"onsails/lspkind-nvim", -- Enables icons on completions
{ -- Snippets
"L3MON4D3/LuaSnip",
requires = {
"saadparwaiz1/cmp_luasnip",
},
},
{
"zbirenbaum/copilot.lua",
event = "InsertEnter",
config = function()
require("copilot").setup()
end,
},
{
"zbirenbaum/copilot-cmp",
after = { "copilot.lua" },
module = "copilot_cmp",
config = function()
require("copilot_cmp").setup()
end,
},
},
},
cmp.lua
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require('lspkind')
local source_mapping = {
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
cmp_tabnine = "[TN]",
path = "[Path]",
}
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end
cmp.setup({
completion = {
autocomplete = {
cmp.TriggerEvent.TextChanged,
cmp.TriggerEvent.InsertEnter,
},
completeopt = "menuone,noinsert,noselect",
-- keyword_length = 0,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- elseif cmp.visible() then
-- cmp.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
["<Tab>"] = vim.schedule_wrap(function(fallback)
if luasnip.expand_or_jumpable() and has_words_before() then
luasnip.expand_or_jump()
elseif cmp.visible() and has_words_before() then
cmp.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })
else
fallback()
end
end),
["<C-j>"] = cmp.mapping({
i = cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}),
}),
["<C-k>"] = cmp.mapping({
i = cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}),
}),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
}),
["<CR>"] = cmp.mapping({
i = cmp.mapping.confirm({select = true}),
}),
-- ["<C-Space>"] = cmp.mapping({
-- i = cmp.mapping.complete(),
-- }),
},
sources = {
{ name = "copilot" },
{ name = 'cmp_tabnine' },
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "path" },
{
name = "buffer",
option = {
-- complete from visible buffers
get_bufnrs = function()
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
bufs[vim.api.nvim_win_get_buf(win)] = true
end
return vim.tbl_keys(bufs)
end,
},
},
},
sorting = {
priority_weight = 2,
comparators = {
require("copilot_cmp.comparators").prioritize,
require("copilot_cmp.comparators").score,
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text", -- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function(entry, vim_item)
vim_item.kind = lspkind.presets.default[vim_item.kind]
local menu = source_mapping[entry.source.name]
if entry.source.name == "cmp_tabnine" then
if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
menu = entry.completion_item.data.detail .. " " .. menu
end
vim_item.kind = ""
end
if entry.source.name == "copilot" then
if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
menu = entry.completion_item.data.detail .. " " .. menu
end
vim_item.kind = ""
end
vim_item.menu = menu
return vim_item
end,
}),
},
experimental = {
view = {
-- entries = true,
entries = { name = 'custom', selection_order = 'near_cursor' }
},
ghost_text = true,
}
})
I'm no longer seeing any copilot suggestions, can you recommend a way to debug?
I have made some changes to my configs, however, I am still seeing suggestions from all other cmp sources.