dochl client offset encoding

neovim_0.6
ray-x 2 years ago
parent 96885ae509
commit 92296c9fc8

@ -20,8 +20,7 @@ local definition_hdlr = util.mk_handler(function(err, locations, ctx, _)
return
end
local client = vim.lsp.get_client_by_id(ctx.client_id)
local oe = require('navigator.util').encoding()
local oe = require('navigator.util').encoding(ctx.client_id)
if vim.tbl_islist(locations) then
if #locations > 1 then
local items = locations_to_items(locations)

@ -153,8 +153,7 @@ local handle_document_highlight = mk_handler(function(_, result, ctx)
end)
references[ctx.bufnr] = result
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
vim.lsp.util.buf_highlight_references(ctx.bufnr, result, util.encoding())
vim.lsp.util.buf_highlight_references(ctx.bufnr, result, util.encoding(client_id))
end)
-- modify from vim-illuminate
local function goto_adjent_reference(opt)
@ -246,9 +245,8 @@ local function documentHighlight()
return
end
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
vim.lsp.util.buf_clear_references(bufnr)
vim.lsp.util.buf_highlight_references(bufnr, result, util.encoding())
vim.lsp.util.buf_highlight_references(bufnr, result, util.encoding(client_id))
table.sort(result, function(a, b)
return before(a.range, b.range)
end)

@ -403,6 +403,12 @@ function M.empty(t)
end
function M.encoding(client)
if type(client) ~= 'table' then
if client == nil then
client = 1
end
client = vim.lsp.get_client_by_id(client)
end
local oe = client.offset_encoding
if oe == nil then
return 'utf-8'

Loading…
Cancel
Save