mirror of
https://github.com/neovim/neovim.git
synced 2025-11-15 06:49:01 +00:00
fix(lsp): deprecate vim.lsp.get_buffers_by_client_id (#36449)
This commit is contained in:
@@ -39,6 +39,8 @@ LSP
|
|||||||
• *vim.lsp.semantic_tokens.stop()* Use `vim.lsp.semantic_tokens.enable(false)` instead
|
• *vim.lsp.semantic_tokens.stop()* Use `vim.lsp.semantic_tokens.enable(false)` instead
|
||||||
• *vim.lsp.set_log_level()* Use `vim.lsp.log.set_level()` instead
|
• *vim.lsp.set_log_level()* Use `vim.lsp.log.set_level()` instead
|
||||||
• *vim.lsp.get_log_path()* Use `vim.lsp.log.get_filename()` instead
|
• *vim.lsp.get_log_path()* Use `vim.lsp.log.get_filename()` instead
|
||||||
|
• *vim.lsp.get_buffers_by_client_id* Use `vim.lsp.get_client_by_id(id).attached_buffers`
|
||||||
|
instead
|
||||||
|
|
||||||
LUA
|
LUA
|
||||||
|
|
||||||
|
|||||||
@@ -1112,16 +1112,6 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
|
|||||||
• {timeout_ms} (`integer`, default: 500ms) The timeout period
|
• {timeout_ms} (`integer`, default: 500ms) The timeout period
|
||||||
for the formatting request..
|
for the formatting request..
|
||||||
|
|
||||||
*vim.lsp.get_buffers_by_client_id()*
|
|
||||||
get_buffers_by_client_id({client_id})
|
|
||||||
Returns list of buffers attached to client_id.
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
• {client_id} (`integer`) client id
|
|
||||||
|
|
||||||
Return: ~
|
|
||||||
(`integer[]`) buffers list of buffer ids
|
|
||||||
|
|
||||||
get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
|
get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
|
||||||
Gets a client by id, or nil if the id is invalid or the client was
|
Gets a client by id, or nil if the id is invalid or the client was
|
||||||
stopped. The returned client may not yet be fully initialized.
|
stopped. The returned client may not yet be fully initialized.
|
||||||
|
|||||||
@@ -1033,9 +1033,15 @@ end
|
|||||||
|
|
||||||
--- Returns list of buffers attached to client_id.
|
--- Returns list of buffers attached to client_id.
|
||||||
---
|
---
|
||||||
|
---@deprecated
|
||||||
---@param client_id integer client id
|
---@param client_id integer client id
|
||||||
---@return integer[] buffers list of buffer ids
|
---@return integer[] buffers list of buffer ids
|
||||||
function lsp.get_buffers_by_client_id(client_id)
|
function lsp.get_buffers_by_client_id(client_id)
|
||||||
|
vim.deprecate(
|
||||||
|
'vim.lsp.get_buffers_by_client_id()',
|
||||||
|
'vim.lsp.get_client_by_id(id).attached_buffers',
|
||||||
|
'0.13'
|
||||||
|
)
|
||||||
local client = lsp.get_client_by_id(client_id)
|
local client = lsp.get_client_by_id(client_id)
|
||||||
return client and vim.tbl_keys(client.attached_buffers) or {}
|
return client and vim.tbl_keys(client.attached_buffers) or {}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,7 +133,8 @@ function M.enable(name, enable, filter)
|
|||||||
for _, it_bufnr in
|
for _, it_bufnr in
|
||||||
ipairs(
|
ipairs(
|
||||||
bufnr and { it_client.attached_buffers[bufnr] and bufnr }
|
bufnr and { it_client.attached_buffers[bufnr] and bufnr }
|
||||||
or vim.lsp.get_buffers_by_client_id(it_client.id)
|
or vim.tbl_keys(it_client.attached_buffers)
|
||||||
|
or {}
|
||||||
)
|
)
|
||||||
do
|
do
|
||||||
if enable ~= M.is_enabled(name, { bufnr = it_bufnr, client_id = it_client.id }) then
|
if enable ~= M.is_enabled(name, { bufnr = it_bufnr, client_id = it_client.id }) then
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ function M.on_refresh(err, _, ctx)
|
|||||||
if err then
|
if err then
|
||||||
return vim.NIL
|
return vim.NIL
|
||||||
end
|
end
|
||||||
for _, bufnr in ipairs(vim.lsp.get_buffers_by_client_id(ctx.client_id)) do
|
for bufnr in ipairs(vim.lsp.get_client_by_id(ctx.client_id).attached_buffers or {}) do
|
||||||
for _, winid in ipairs(api.nvim_list_wins()) do
|
for _, winid in ipairs(api.nvim_list_wins()) do
|
||||||
if api.nvim_win_get_buf(winid) == bufnr then
|
if api.nvim_win_get_buf(winid) == bufnr then
|
||||||
if bufstates[bufnr] and bufstates[bufnr].enabled then
|
if bufstates[bufnr] and bufstates[bufnr].enabled then
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ function M._refresh(err, _, ctx)
|
|||||||
return vim.NIL
|
return vim.NIL
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, bufnr in ipairs(vim.lsp.get_buffers_by_client_id(ctx.client_id)) do
|
for bufnr in ipairs(vim.lsp.get_client_by_id(ctx.client_id).attached_buffers or {}) do
|
||||||
local highlighter = STHighlighter.active[bufnr]
|
local highlighter = STHighlighter.active[bufnr]
|
||||||
if highlighter and highlighter.client_state[ctx.client_id] then
|
if highlighter and highlighter.client_state[ctx.client_id] then
|
||||||
highlighter:mark_dirty(ctx.client_id)
|
highlighter:mark_dirty(ctx.client_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user