fix(lsp): fetch offset_encoding from client in references (#17104)

This commit is contained in:
Michael Lingelbach 2022-01-15 15:49:29 -08:00 committed by GitHub
parent 561df30981
commit a0201b6ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,18 +166,19 @@ M['textDocument/references'] = function(_, result, ctx, config)
if not result or vim.tbl_isempty(result) then
vim.notify('No references found')
else
local client = vim.lsp.get_client_by_id(ctx.client_id)
config = config or {}
if config.loclist then
vim.fn.setloclist(0, {}, ' ', {
title = 'References';
items = util.locations_to_items(result, ctx.offset_encoding);
items = util.locations_to_items(result, client.offset_encoding);
context = ctx;
})
api.nvim_command("lopen")
else
vim.fn.setqflist({}, ' ', {
title = 'References';
items = util.locations_to_items(result, ctx.offset_encoding);
items = util.locations_to_items(result, client.offset_encoding);
context = ctx;
})
api.nvim_command("botright copen")