haskell / haskell/haskell-language-server

incoming / outgoing call hierarchy for local identifiers

Open
#3,831 8 comments 0 reactions 0 assignees View on GitHub
component: hls-call-hierarchy-plugin type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

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" }} 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" {} 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 }}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.