Description
Your environment
Which OS do you use?
Fedora/Linux
Which version of GHC do you use and how did you install it?
ghc-9.6.2
How is your project built (alternative: link to the project)?
I think it's irrelevant, I've seen this in various projects.
Which LSP client (editor/plugin) do you use?
Neovim with the build in lsp
Which version of HLS do you use and how did you install it?
HLS 2.3.0.0
installed with ghcup
Have you configured HLS in any way (especially: a hie.yaml
file)?
no
Steps to reproduce
Ask for the incoming (or outgoing) call hierarchy of a local identifier, e.g. one defined in a where
clause.
Expected behaviour
Return call hierarchy.
Actual behaviour
HLS fails with:
2023-10-08T09:54:19.072739Z | Error | LSP: incoming message parse error:
Error in $.params: parsing CallHierarchyIncomingCallsParams failed, expected Object, but encountered Array
when processing
{"method":"callHierarchy\/incomingCalls","id":7,"params":[],"jsonrpc":"2.0"}
Debug information
The callHierarchy/incomingCalls
callHierarchy/prepareCallHierarchy
returns an empty array {}
. It is send back to callHierarchy/incomingCalls
as params
. I think that there's a bug in neovim
lsp
which encodes the empty array {}
as an empty list instead of an empty object (the neovim
lsp
is written in lua, which doesn't make a distinction between lists & objects); but also a hls
problem: why callHierarchy/prepareCallHierarchy
returns {}
in the first place.
The client side log:
[DEBUG][2023-10-08 11:54:14] .../lua/vim/lsp.lua:1391 "LSP[hls]" "client.request" 1 "textDocument/prepareCallHierarchy" { position = { character = 4, line = 864 }, textDocument = { uri = "file:///home/coot/src/haskell/ghc-tags-plugin/ghc-tags-core/lib/GhcTags/Ghc.hs" }} <function 1> 1
[DEBUG][2023-10-08 11:54:14] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 6, jsonrpc = "2.0", method = "textDocument/prepareCallHierarchy", params = { position = { character = 4, line = 864 }, textDocument = { uri = "file:///home/coot/src/haskell/ghc-tags-plugin/ghc-tags-core/lib/GhcTags/Ghc.hs" } }}
[DEBUG][2023-10-08 11:54:14] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 6, jsonrpc = "2.0", result = {}}
[ERROR][2023-10-08 11:54:14] .../vim/lsp/rpc.lua:734 "rpc" "/home/coot/.ghcup/bin/haskell-language-server-wrapper" "stderr" "2023-10-08T09:54:14.889113Z | Debug | Finished: CallHierarchy.prepareHierarchy Took: 0.00s\n"
[DEBUG][2023-10-08 11:54:19] .../lua/vim/lsp.lua:1391 "LSP[hls]" "client.request" 1 "callHierarchy/incomingCalls" {} <function 1> 1
[DEBUG][2023-10-08 11:54:19] .../vim/lsp/rpc.lua:284 "rpc.send" { id = 7, jsonrpc = "2.0", method = "callHierarchy/incomingCalls", params = {}}
[ERROR][2023-10-08 11:54:19] .../vim/lsp/rpc.lua:734 "rpc" "/home/coot/.ghcup/bin/haskell-language-server-wrapper" "stderr" '2023-10-08T09:54:19.072997Z | Error | LSP: incoming message parse error:\nError in $.params: parsing CallHierarchyIncomingCallsParams failed, expected Object, but encountered Array\nwhen processing\n{"method":"callHierarchy\\/incomingCalls","id":7,"params":[],"jsonrpc":"2.0"}\n'
[DEBUG][2023-10-08 11:54:19] .../vim/lsp/rpc.lua:387 "rpc.receive" { jsonrpc = "2.0", method = "window/showMessage", params = { message = 'Error condition, please check your setup and/or the [issue tracker](https://github.com/haskell/haskell-language-server/issues): \nLSP: incoming message parse error:\nError in $.params: parsing CallHierarchyIncomingCallsParams failed, expected Object, but encountered Array\nwhen processing\n{"method":"callHierarchy\\/incomingCalls","id":7,"params":[],"jsonrpc":"2.0"}', type = 1 }}