rebelot / heirline.nvim

Heirline.nvim is a no-nonsense Neovim Statusline plugin designed around recursive inheritance to be exceptionally fast and versatile.
MIT License
1.02k stars 40 forks source link

fix(conditions): make `lsp_attached` use non-deprecated methods #193

Closed PriceHiller closed 4 months ago

PriceHiller commented 4 months ago

Hello! The latest stable release of Neovim (0.10.0) has deprecated the vim.lsp.buf_get_clients method.

This PR does a check for the newer method to get lsp clients and uses that instead if its available -- otherwise it falls back on vim.lsp.buf_get_clients

rebelot commented 4 months ago

I've addressed the issue in latest commit

rebelot commented 4 months ago

thanks!

omar25h commented 4 months ago

I think this MR is still needed for those who are on nightly since vim.lsp.buf_get_clients() is deprecated.

olimorris commented 4 months ago

@rebelot this PR is still needed for Neovim v0.11. We're seeing the below type of errors still:

vim.lsp.buf_get_clients() is deprecated, use vim.lsp.get_clients() instead. :help deprecated
Feature will be removed in Nvim 0.12
stack traceback:
        /usr/local/share/nvim/runtime/lua/vim/lsp.lua:1092: in function 'buf_get_clients'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/conditions.lua:64: in function 'condition'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:317: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:398: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:398: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:473: in function 'eval'
        ...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/init.lua:114: in function <...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/init.lua:109>
rebelot commented 4 months ago

I apologize, for some reason the changes to this file were not committed