Skip to content

Commit

Permalink
fix: pass offset_encoding in some make params util functions(#3449)
Browse files Browse the repository at this point in the history
  • Loading branch information
rockyzhang24 authored Nov 24, 2024
1 parent 3002276 commit 022134a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lua/lspconfig/configs/clangd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ local function symbol_info()
if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
end
local params = vim.lsp.util.make_position_params()
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, clangd_client.offset_encoding)
clangd_client.request('textDocument/symbolInfo', params, function(err, res)
if err or #res == 0 then
-- Clangd always returns an error, there is not reason to parse it
Expand Down
11 changes: 8 additions & 3 deletions lua/lspconfig/configs/texlab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ local function client_with_fn(fn)
end

local function buf_build(client, bufnr)
client.request('textDocument/build', vim.lsp.util.make_position_params(), function(err, result)
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
client.request('textDocument/build', params, function(err, result)
if err then
error(tostring(err))
end
Expand All @@ -27,7 +29,9 @@ local function buf_build(client, bufnr)
end

local function buf_search(client, bufnr)
client.request('textDocument/forwardSearch', vim.lsp.util.make_position_params(), function(err, result)
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
client.request('textDocument/forwardSearch', params, function(err, result)
if err then
error(tostring(err))
end
Expand Down Expand Up @@ -91,9 +95,10 @@ local function command_factory(cmd)
end

local function buf_find_envs(client, bufnr)
local win = vim.api.nvim_get_current_win()
client.request('workspace/executeCommand', {
command = 'texlab.findEnvironments',
arguments = { vim.lsp.util.make_position_params() },
arguments = { vim.lsp.util.make_position_params(win, client.offset_encoding) },
}, function(err, result)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
Expand Down

0 comments on commit 022134a

Please sign in to comment.