diff --git a/nvim/.config/nvim/lua/lsp.lua b/nvim/.config/nvim/lua/lsp.lua index 4e552d2..40ddfd2 100644 --- a/nvim/.config/nvim/lua/lsp.lua +++ b/nvim/.config/nvim/lua/lsp.lua @@ -11,8 +11,13 @@ local preview_location_callback = function(_, result) end local peek_definition = function() - local params = vim.lsp.util.make_position_params() - return vim.lsp.buf_request(0, 'textDocument/definition', params, preview_location_callback) + local bufnr = vim.api.nvim_get_current_buf() + 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 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 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 vim.lsp.buf_request(bufnr, 'textDocument/codeAction', params, function(err, result, ctx, config)