jaredly / jaredly/reason-language-server
Unexpected hover result on nested record members
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 649
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I'm running into some issues with what's reported in hovers. Here's some example code:
```reason
type owner = {name: string};
type group = {
id: string,
name: string,
owner,
};
type user = {
id: string,
memberOf: group,
};
external getTestUser: unit => user = "%identity";
external getTestGroup: unit => group = "%identity";
let make = () => {
let user = getTestUser();
let group = getTestGroup();
user;
group;
user.memberOf;
user.memberOf.owner;
};
```
When I hover `user` and `group` at the bottom of the code block, I get the results I expect in the hover - each type definition is shown as expected.
When I hover `user` in `user.memberOf`, I also get what I expect - the type definition for user.
However, when I hover `memberOf` in `user.memberOf`, I *don't* get the definition for `group`, but rather still the definition for `user`. And when I move to the next line and hover `owner` in `user.memberOf.owner`, I get the definition for `group` where I should be getting the definition for `owner`.
So, to summarize:
`user.memberOf` gives me *user.user* when I should be getting *user.group*
`user.memberOf.owner` gives me *user.user.group* when I should be getting *user.group.owner*
Please let me know if there's anything else I can do to explain this better.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hover behavior with the Reason example in the issue, checking each nested member in `user.memberOf` and `user.memberOf.owner`. Trace the language server's hover handling for nested record-member expressions and consider the work complete when those hovers resolve to `group` and `owner` respectively.
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