Skip to content

Commit

Permalink
fix(lsp/nightly): set offset encoding in client requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Nov 29, 2024
1 parent 2a190c9 commit 361d36e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lua/haskell-tools/hoogle/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ local function mk_lsp_hoogle_signature_handler(options)
end

---@param options table
local function lsp_hoogle_signature(options)
local params = lsp_util.make_position_params()
---@param offset_encoding 'utf-8'|'utf-16'|'utf-32'
local function lsp_hoogle_signature(options, offset_encoding)
local params = lsp_util.make_position_params(0, offset_encoding)
return vim.lsp.buf_request(0, 'textDocument/hover', params, mk_lsp_hoogle_signature_handler(options))
end

Expand Down Expand Up @@ -100,9 +101,9 @@ Hoogle.hoogle_signature = function(options)
return
end
local LspHelpers = require('haskell-tools.lsp.helpers')
local clients = LspHelpers.get_clients { bufnr = vim.api.nvim_get_current_buf() }
local clients = LspHelpers.get_active_haskell_clients(vim.api.nvim_get_current_buf())
if #clients > 0 then
lsp_hoogle_signature(options)
lsp_hoogle_signature(options, clients[1].offset_encoding)
else
log.debug('Hoogle signature search: No clients attached. Falling back to <cword>.')
local cword = vim.fn.expand('<cword>')
Expand Down

0 comments on commit 361d36e

Please sign in to comment.