fix(copilot): work-around Neovim bug. Fixes

This commit is contained in:
Folke Lemaitre
2023-04-21 18:27:15 +02:00
parent eb92903342
commit 4379ae8ab9
2 changed files with 4 additions and 4 deletions
lua/lazyvim
plugins/extras/coding
util

@ -28,8 +28,8 @@ return {
return icon .. (status.message or "") return icon .. (status.message or "")
end, end,
cond = function() cond = function()
local clients = vim.lsp.get_active_clients({ name = "copilot", bufnr = 0 }) local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
return #clients > 0 return ok and #clients > 0
end, end,
color = function() color = function()
local status = require("copilot.api").status.data local status = require("copilot.api").status.data
@ -76,7 +76,7 @@ return {
["<CR>"] = function(...) ["<CR>"] = function(...)
local entry = cmp.get_selected_entry() local entry = cmp.get_selected_entry()
if entry and entry.source.name == "copilot" then if entry and entry.source.name == "copilot" then
return confirm_copilot(...) -- return confirm_copilot(...)
end end
return confirm(...) return confirm(...)
end, end,

@ -215,7 +215,7 @@ To use this, add it to your **lazy.nvim** imports:
```lua title="lua/config/lazy.lua" {4} ```lua title="lua/config/lazy.lua" {4}
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" }, { "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "%s" }, { import = "%s" },
{ import = "plugins" }, { import = "plugins" },
}, },