From a5c598871bcc16f1bc6fb8d46eb826d83d7d0f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Sun, 3 Aug 2025 15:39:49 -0700 Subject: [PATCH] fix(lsp): compare to `vim.NIL` in `lsp/buf.lua` #35154 --- runtime/lua/vim/lsp/buf.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 2f8c1c02ac..033a9fac84 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -723,7 +723,7 @@ function M.rename(new_name, opts) if client:supports_method(ms.textDocument_prepareRename) then local params = util.make_position_params(win, client.offset_encoding) client:request(ms.textDocument_prepareRename, params, function(err, result) - if err or result == nil then + if err or result == vim.NIL then if next(clients, idx) then try_use_client(next(clients, idx)) else @@ -809,7 +809,11 @@ function M.references(context, opts) for client_id, res in pairs(results) do local client = assert(lsp.get_client_by_id(client_id)) - local items = util.locations_to_items(res.result or {}, client.offset_encoding) + local result = res.result + if result == vim.NIL then + result = {} + end + local items = util.locations_to_items(result, client.offset_encoding) vim.list_extend(all_items, items) end