haskell / haskell/haskell-language-server

Type-aware autocompletion

Open
#2,081 8 comments 7 reactions 0 assignees View on GitHub
component: ghcide status: in discussion type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
4d 3h
Merged PRs (30d)
12

Description

Hi, I'm surprised that I couldn't find a similar issue, except for https://github.com/haskell/haskell-language-server/issues/817. Please excuse me if it is misplaced.

I wish HLS provided type-aware autocompletion. The autocompletion it does have often isn't very useful:
![image](https://user-images.githubusercontent.com/7235381/128347996-ce804ffc-a16e-47e7-be20-05a9c1efeaec.png)

In this case, the obvious type-correct autocompletion would be `ssDynTrace`, of type `[DynTraceEntry]`. Instead, the autocompletion is full of relevant but quite useless definitions. In fact, `ssDynTrace` isn't even listed until I type a `d`.
![image](https://user-images.githubusercontent.com/7235381/128358912-177db032-2469-4664-9178-b8524755203b.png)

Another issue is that with record wildcards, there are duplicate completions available. Here, `ssDynTrace` is listed once as the value from the wildcard and once more as the getter function.
![image](https://user-images.githubusercontent.com/7235381/128359820-3360693a-a418-4dda-9cf1-6569e80db1ca.png)

In theory, I could use a hole instead, but invoking Wingman with many bindings in scope isn't a good idea:
![image](https://user-images.githubusercontent.com/7235381/128348312-6950abeb-f12a-43b9-9204-4bc3bcfedadb.png)

Even if VS Code made the quick action list searchable, the "attempt to fill hole" and "refine hole" commands time out. Plus, Wingman doesn't seem like the right tool for the job – I know pretty well what I want to write, I just don't want to have to spell every identifier out, and the types involved don't uniquely identify the correct solution.

It'd be nice if HLS could trim the autocompletion suggestions by type and offer relevant suggestions even with no prior identifier input.

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.