Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed deprecation #19

Open
wants to merge 2 commits into
base: table_version
Choose a base branch
from

Conversation

einCyberSimon
Copy link

@einCyberSimon einCyberSimon commented May 17, 2024

vim.lsp.buf_get_clients() will be deprecated in version 12, it is reccomended to use vim.lsp.get_clients() instead

vim.lsp.buf_get_clients() will be depreciated in version 12, it is
reccomended to use vim.lsp.get_clients() instead
@orumin
Copy link

orumin commented May 27, 2024

You might want to specify the buffer number to get LSP active client per buffer like the below:

diff --git a/lua/sttusline/components/lsps-formatters.lua b/lua/sttusline/components/lsps-formatters.lua
index 6972b3d..2904a71 100644
--- a/lua/sttusline/components/lsps-formatters.lua
+++ b/lua/sttusline/components/lsps-formatters.lua
@@ -6,5 +6,6 @@ return {
        colors = { fg = colors.magenta }, -- { fg = colors.black, bg = colors.white }
        update = function()
-               local buf_clients = vim.lsp.buf_get_clients()
+               local bufnr = vim.api.nvim_get_current_buf()
+               local buf_clients = vim.lsp.get_clients({ bufnr = bufnr })
                local server_names = {}
                local has_null_ls = false
@@ -24,5 +25,5 @@ return {

                        if has_null_ls then
-                               local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
+                               local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
                                local null_ls_methods = {

@einCyberSimon einCyberSimon changed the title Fix: Fixed depreciation Fix: Fixed deprecation Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants