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(lsp): fix get_active_clients bufnr parameter #21366

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(lsp): fix get_active_clients bufnr parameter
Follow up to #21337
  • Loading branch information
mfussenegger committed Dec 9, 2022
commit 22292faa4978d0c51117ef170a78993fc5ccb359
6 changes: 3 additions & 3 deletions runtime/lua/vim/lsp/buf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ end
---
function M.list_workspace_folders()
local workspace_folders = {}
for _, client in pairs(vim.lsp.get_active_clients({ buffer = 0 })) do
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
for _, folder in pairs(client.workspace_folders or {}) do
table.insert(workspace_folders, folder.name)
end
Expand All @@ -489,7 +489,7 @@ function M.add_workspace_folder(workspace_folder)
{ { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } },
{ {} }
)
for _, client in pairs(vim.lsp.get_active_clients({ buffer = 0 })) do
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
local found = false
for _, folder in pairs(client.workspace_folders or {}) do
if folder.name == workspace_folder then
Expand Down Expand Up @@ -522,7 +522,7 @@ function M.remove_workspace_folder(workspace_folder)
{ {} },
{ { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } }
)
for _, client in pairs(vim.lsp.get_active_clients({ buffer = 0 })) do
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
for idx, folder in pairs(client.workspace_folders) do
if folder.name == workspace_folder then
vim.lsp.buf_notify(0, 'workspace/didChangeWorkspaceFolders', params)
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ function M._get_offset_encoding(bufnr)

local offset_encoding

for _, client in pairs(vim.lsp.get_active_clients({ buffer = bufnr })) do
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
if client.offset_encoding == nil then
vim.notify_once(
string.format(
Expand Down