meuter / lualine-so-fancy.nvim

Small collection of _fancy_ components for the lualine.nvim plugin.
MIT License
73 stars 4 forks source link

`vim.lsp.buf_get_clients` is deprecated in fancy_lsp_servers #4

Closed pysan3 closed 2 days ago

pysan3 commented 1 month ago

Thank you @meuter for the amazing plugin.

As you can see in the error message below, vim.lsp.buf_get_clients is deprecated in neovim core and I get a warning message everytime I launch neovim.

Could you fix it to use vim.lsp.get_clients instead? More information found in :h deprecated.

- *vim.lsp.buf_get_clients()*           Use |vim.lsp.get_clients()| with
                        {buffer=bufnr} instead.
   Warn  11:00:03 notify.warn vim.lsp.buf_get_clients() is deprecated, use vim.lsp.get_clients() instead. :help deprecated
Feature will be removed in Nvim 0.12
   Warn  11:00:03 notify.warn stack traceback:
    ...rs/.local/share/nvim/runtime/lua/vim/lsp.lua:1092: in function 'buf_get_clients'
    ...-fancy.nvim/lua/lualine/components/fancy_lsp_servers.lua:10: in function 'update_status'
    ...l/share/nvim/lazy/lualine.nvim/lua/lualine/component.lua:273: in function 'draw'
    ...are/nvim/lazy/lualine.nvim/lua/lualine/utils/section.lua:26: in function 'draw_section'
    ...itoi/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:170: in function <.../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:160>
    [C]: in function 'pcall'
    ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:166: in function 'statusline'
    .../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:298: in function <.../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:279>
    [C]: in function 'nvim_win_call'
    .../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: in function 'refresh'
    .../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:508: in function <.../.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:507>
    [C]: in function 'pcall'
    ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:214: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
   Warn  11:00:05 notify.warn Defining diagnostic signs with :sign-define or sign_define() is deprecated, use vim.diagnostic.config() instead. :help deprecated
Feature will be removed in Nvim 0.12
meuter commented 1 month ago

Hi @pysan3

Thanks for your kind words.

Regarding vim.lsp.buf_get_clients, had no seen this yet. Thanks for the heads up. I'll make the necessary changes over the weekend.

Keep you posted.

-Cédric

meuter commented 1 month ago

Fix is up. Let me know if you encounter any problem.

wert2all commented 1 month ago

I got an error fancy.nvim/lua/lualine/components/fancy_lsp_servers.lua:10: attempt to call field 'get_clients' (a nil value)

nvim --version NVIM v0.9.5

meuter commented 1 month ago

Arg. I was afraid of this. I tested on 0.10.0. Let me roll this back. I'll make a more robus fix.

meuter commented 2 days ago

I just pushed a more robust fix. I tested it with 0.9.5, 0.10.0 and nightly. I don't see any more warnings. If you encounter any issue in your particular config, of course, feel free to re-open.