Skip to content

Commit 43ec3b2

Browse files
authored
fix(hover): error message with definition/typeDefinition hover actions (#218)
- Affects neovim-nightly (10.x). ###### Things done - [x] Tested, as applicable: - [x] Manually - [x] Updated [CHANGELOG.md](https://github.com/MrcJkb/haskell-tools.nvim/blob/master/CHANGELOG.md) (if applicable). - [x] Fits [CONTRIBUTING.md](https://github.com/MrcJkb/haskell-tools.nvim/blob/master/CONTRIBUTING.md)
1 parent 44dca47 commit 43ec3b2

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.11.1] - 2023-07-17
9+
### Fixed
10+
- Hover: Fix error message when using go-to-definition/typeDefinition hover actions
11+
with neovim-nightly (10.x).
12+
813
## [1.11.0] - 2023-07-05
914
### Changed
1015
- Improvements to type signature detection from `textDocument/hover` docs.

lua/haskell-tools/lsp/hover.lua

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function hover.on_hover(_, result, ctx, config)
131131
ht.log.debug { 'Hover: Hoogle search for cword', cword }
132132
ht.hoogle.hoogle_signature { search_term = cword }
133133
end)
134-
local params = lsp_util.make_position_params()
134+
local params = ctx.params
135135
local found_location = false
136136
local found_type_definition = false
137137
local found_documentation = false
@@ -173,12 +173,11 @@ function hover.on_hover(_, result, ctx, config)
173173
table.insert(actions, 1, string.format('%d. Go to definition at ' .. location_suffix, #actions + 1))
174174
table.insert(_state.commands, function()
175175
-- We don't call vim.lsp.buf.definition() because the location params may have changed
176-
local definition_ctx = {
176+
local definition_ctx = vim.tbl_extend('force', ctx, {
177177
method = 'textDocument/definition',
178-
client_id = ctx.client_id,
179-
}
178+
})
180179
ht.log.debug { 'Hover: Go to definition', definition_result }
181-
vim.lsp.handlers['textDocument/definition'](_, definition_result, definition_ctx)
180+
vim.lsp.handlers['textDocument/definition'](nil, definition_result, definition_ctx)
182181
end)
183182
end
184183
end
@@ -212,12 +211,11 @@ function hover.on_hover(_, result, ctx, config)
212211
table.insert(actions, 1, string.format('%d. Go to type definition at ' .. type_def_suffix, #actions + 1))
213212
table.insert(_state.commands, function()
214213
-- We don't call vim.lsp.buf.typeDefinition() because the location params may have changed
215-
local type_definition_ctx = {
214+
local type_definition_ctx = vim.tbl_extend('force', ctx, {
216215
method = 'textDocument/typeDefinition',
217-
client_id = ctx.client_id,
218-
}
216+
})
219217
ht.log.debug { 'Hover: Go to type definition', type_definition_result }
220-
vim.lsp.handlers['textDocument/typeDefinition'](_, type_definition_result, type_definition_ctx)
218+
vim.lsp.handlers['textDocument/typeDefinition'](nil, type_definition_result, type_definition_ctx)
221219
end)
222220
end
223221
end

0 commit comments

Comments
 (0)