From cf5f1492d702f940934b0b40024d1741e4474542 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 4 Jul 2023 20:30:31 +0800 Subject: fix(lsp): revert change to buf.clear_references() #24238 Problem: in #24046 the signature of buf.clear_references() changed, which indirectly breaks callers that were passing "ignored" args. Solution: because util.buf_clear_references() already defaulted to "current buffer", the change to buf.clear_references() isn't actually needed, so just revert it. --- runtime/lua/vim/lsp/buf.lua | 5 ++--- runtime/lua/vim/lsp/util.lua | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index c742505ec6..bac66b671d 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -581,9 +581,8 @@ function M.document_highlight() end --- Removes document highlights from current buffer. ---- @param bufnr integer|nil -function M.clear_references(bufnr) - util.buf_clear_references(bufnr or 0) +function M.clear_references() + util.buf_clear_references() end ---@private diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 6cb91417f2..8d6f88bb2c 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1769,9 +1769,9 @@ do --[[ References ]] --- Removes document highlights from a buffer. --- - ---@param bufnr integer Buffer id + ---@param bufnr integer|nil Buffer id function M.buf_clear_references(bufnr) - validate({ bufnr = { bufnr, { 'n', 'nil' }, true } }) + validate({ bufnr = { bufnr, { 'n' }, true } }) api.nvim_buf_clear_namespace(bufnr or 0, reference_ns, 0, -1) end -- cgit