rescript-lang / rescript-lang/rescript
Completions defined in `editor.autocomplete` don't work on type aliases
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 7.5k
- Forks
- 485
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 55
Description
I have a module BeltMapX with utility functions for working with Belt.Map.t.
I tried to set up autocomplete for pipe completion in rescript.json like so:
"editor": {
"autocomplete": {
"Belt.Map.t": ["BeltMapX"],
}
}
This didn't work so I did some debugging in analysis/src/CompletionBackEnd.ml, and it turned out that mainTypeId is actually Belt_Map.t.
Updating my rescript.json config to use the unaliased type, as below, worked.
"editor": {
"autocomplete": {
"Belt_Map.t": ["BeltMapX"],
}
}
Would it be possible to make the completions backend handle type aliases so that "Belt.Map.t": ["BeltMapX"] works?
Contributor guide
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
Start in analysis/src/CompletionBackEnd.ml at the handling referenced around lines 1068-1077, and compare the configured type name Belt.Map.t with the resolved Belt_Map.t. The work is done when autocomplete configured with the aliased type name produces completions for BeltMapX, while the existing unaliased configuration continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers, developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100