Open einCyberSimon opened 2 months ago
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 = {
vim.lsp.buf_get_clients() will be depreciated in version 12, it is reccomended to use vim.lsp.get_clients() instead