nvim: lsp: offset_encoding is now a required parameter

See
629483e24e
This commit is contained in:
Sanchayan Maity 2024-11-21 14:31:45 +05:30
parent 5c00f581bf
commit 474e62d942
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -11,8 +11,13 @@ local preview_location_callback = function(_, result)
end end
local peek_definition = function() local peek_definition = function()
local params = vim.lsp.util.make_position_params() local bufnr = vim.api.nvim_get_current_buf()
return vim.lsp.buf_request(0, 'textDocument/definition', params, preview_location_callback) local clients = vim.lsp.get_clients({ bufnr = bufnr })
if next(clients) then
local params = vim.lsp.util.make_position_params(0, clients[1].offset_encoding)
return vim.lsp.buf_request(bufnr, 'textDocument/definition', params, preview_location_callback)
end
end end
local inlay_hint_toggle = function() local inlay_hint_toggle = function()
@ -206,7 +211,7 @@ local on_attach = function(client_id, client, bufnr)
local lsp_diagnostics = vim.lsp.diagnostic.from(vim.diagnostic.get(bufnr, diag_opts)) local lsp_diagnostics = vim.lsp.diagnostic.from(vim.diagnostic.get(bufnr, diag_opts))
local context = { diagnostics = lsp_diagnostics } local context = { diagnostics = lsp_diagnostics }
local params = lsp_util.make_range_params() local params = lsp_util.make_range_params(0, client.offset_encoding)
params.context = context params.context = context
vim.lsp.buf_request(bufnr, 'textDocument/codeAction', params, function(err, result, ctx, config) vim.lsp.buf_request(bufnr, 'textDocument/codeAction', params, function(err, result, ctx, config)