fix(lsp): allow specifying bufnr + client_id filter when enabling capabilities #37690

Today there is a constraint that these arguments to the enable filter be
mutually exclusive, but I do not know why such a constraint exists (it
is perfectly reasonable to want to enable a capabilility for just one
buffer and just one client).

(cherry picked from commit ed267268b8)
This commit is contained in:
Gregory Anders
2026-06-17 05:26:18 -06:00
committed by github-actions[bot]
parent 5ff4e147d0
commit 5c38490806

View File

@@ -124,7 +124,6 @@ function M.enable(name, enable, filter)
filter = filter or {}
local bufnr = filter.bufnr and vim._resolve_bufnr(filter.bufnr)
local client_id = filter.client_id
assert(not (bufnr and client_id), '`bufnr` and `client_id` are mutually exclusive.')
local var = make_enable_var(name)
local client = client_id and vim.lsp.get_client_by_id(client_id)