jaredly / jaredly/reason-language-server

Shadowing definitions break type hovers

Open
#234 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
649
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Consider a module:

```ocaml
module Foo = struct
let a b = b + b
let c d = a d
let a b = b + b
let d f = a f
end
```

A hover on the first `a` will work, but hovering on later definitions `c`, `a`', or `d` yield nothing. Each of these show up in the log like so:

```
[server] Got a method textDocument/hover
[server] processing took 0.0100135803223ms
Sending response {"id": 1949, "jsonrpc": "2.0", "result": null}
```

If I remove the extraneous later `a` definition:

```ocaml
module Foo = struct
let a b = b + b
let c d = a d
let d f = a f
end
```

…then hovers on all declarations work as expected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the OCaml module shown, then compare hover responses with and without the later shadowing definition. Start at the textDocument/hover request handling and trace how definitions are resolved; done means hovers on c, the later a, and d return results despite shadowing.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.