From eb3d59126eff50c64c2108e308884a722e7ee32e Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Wed, 17 Nov 2021 12:14:45 -0800 Subject: fix(lsp): change signature of buf_highlight_references (#16345) the prior signature did not assume an active language client this function can now be used directly by passing an offset encoding defaults to utf-16 (standard for LSP) --- runtime/lua/vim/lsp/handlers.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/handlers.lua') diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index a561630c2b..fa4f2b22a5 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -350,7 +350,10 @@ M['textDocument/signatureHelp'] = M.signature_help --see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight M['textDocument/documentHighlight'] = function(_, result, ctx, _) if not result then return end - util.buf_highlight_references(ctx.bufnr, result, ctx.client_id) + local client_id = ctx.client_id + local client = vim.lsp.get_client_by_id(client_id) + if not client then return end + util.buf_highlight_references(ctx.bufnr, result, client.offset_encoding) end ---@private -- cgit