Closed stankovictab closed 1 year ago
Same error
Does the error persist when uncommenting this line?
-- after = {"jonahgoldwastaken/copilot-status.nvim"},
I think I've finally got it working, actually.
The reason copilot-status wasn't being loaded into the module is because it obviously wasn't loaded by packer, and that is because my Copilot config (which copilot-status is dependant on) is set to load on cmd='Copilot', event='InsertEnter'
, in other words, Copilot would start only when I go into insert mode, and copilot-status doesn't like that because it needs to display the status as soon as you enter NeoVim, and because of that lualine crashes. So, I commented out the cmd
and event
keys from "zbirenbaum/copilot.lua", set the appropriate after
keys for copilot-status and lualine, and it now works.
It sucks a bit that Copilot will be loaded up every time on opening NeoVim, but hey.
And it's also weird how if I try to set the after
keys on either copilot-status or lualine, packer just goes crazy and crashes lualine with the above mentioned error. Really bizzare, don't know if that's a problem with packer itself.
Anyway, here's the config.
use {
"zbirenbaum/copilot.lua",
-- cmd = "Copilot",
-- event = "InsertEnter", -- Copilot will be started only when entering insert mode
config = function()
-- ................ a lot of stuff here ..............
end
}
use {
'jonahgoldwastaken/copilot-status.nvim',
-- after = { 'zbirenbaum/copilot.lua' },
-- event = "BufReadPost",
config = function()
require('copilot_status').setup {
icons = {
idle = " ",
error = " ",
offline = " ",
warning = "𥉉 ",
loading = " ",
},
debug = false,
}
end
}
use {
'nvim-lualine/lualine.nvim', -- Way better status line than Airline
-- after = { 'jonahgoldwastaken/copilot-status.nvim' },
config = "require('stankovictab.specifics.lualine')"
}
The lualine config file didn't change.
@stankovictab I updated copilot-status to be more forgiving when copilot is not yet initialised (also checking if copilot is loaded on InsertEnter
, for example). Let me know if your old configuration works with it and feel free to reopen the issue with further comments. :smile:
Seems to load better now, yeah, but packer still fails loading up lualine when I add after = { 'zbirenbaum/copilot.lua' }
in copilot-status's packer config, so I'm still keeping that commented. However, I still don't think it's working as expected. For instance, when I open up a file the icon is in loading mode, which is good, but when I go into insert mode to type, and when Copilot activates and starts giving suggestions, the icon is still on loading mode. If I then open another buffer, the icon updates to the idle mode on both buffers. If instead of opening a new buffer I do :LspInfo
, the icon changes to the offline mode, even though copilot still works. Don't ask me how I figured that one out, it's pure coincidence. I know this isn't related to this issue, it's just something I noticed.
Maybe I should clarify this in the docs, but the status indicator is tied to the current buffer. If it's not attached to the buffer (as with :LspInfo
) it's marked as offline, as there is no copilot client attached to the buffer. Maybe a "detached" icon would be better for this?
When the loading indicator seems "stuck", it's because copilot is still indicating it's loading suggestions. I don't augment any status, so whatever copilot gives me is displayed. Copilot does have the tendency to get stuck on loading when it can't find a proper suggestion I've realised, and can sometimes stay that way when you leave insert mode.
I'm getting this error that lualine can't find the
copilot_status
module, even though Copilot is loaded correctly, and lualine is loaded after copilot-status.plugins.lua :
lualine.lua :