From 0011b1148d3975600f5a9f0be8058cdaac4e30d9 Mon Sep 17 00:00:00 2001 From: Chinmay Dalal Date: Tue, 18 Jan 2022 12:40:15 +0530 Subject: [PATCH] fix: add offset encoding to `vim.lsp.util.locations_to_items()` call (#1694) --- lua/telescope/builtin/lsp.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index 737cad1..266d1df 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -16,7 +16,7 @@ lsp.references = function(opts) local params = vim.lsp.util.make_position_params() params.context = { includeDeclaration = true } - vim.lsp.buf_request(0, "textDocument/references", params, function(err, result, _ctx, _config) + vim.lsp.buf_request(0, "textDocument/references", params, function(err, result, ctx, _config) if err then vim.api.nvim_err_writeln("Error when finding references: " .. err.message) return @@ -24,7 +24,10 @@ lsp.references = function(opts) local locations = {} if result then - vim.list_extend(locations, vim.lsp.util.locations_to_items(result) or {}) + vim.list_extend( + locations, + vim.lsp.util.locations_to_items(result, vim.lsp.get_client_by_id(ctx.client_id).offset_encoding) or {} + ) end if vim.tbl_isempty(locations) then