haskell / haskell/haskell-language-server

Add Hover information for resolved type classes

Open
#4,290 1 comment 2 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

The GHC AST makes liberal use of type families for Trees that Grow extension points.

When working on code that matches on a constructor, the hover information gives the type, which is as-written for the constructor, with a general parameter for the TTG extension point.

But in GHC the extension point parameter is either known precisely (e.g. `GhcPs`) or at least limited (`GhcPass p)`.

Regardless, there are type family instances in the project for the given type family. These should be displayed in addition to the current hover information.

![Screenshot from 2024-06-08 15-25-57](https://github.com/haskell/haskell-language-server/assets/409607/acf11a9a-86d9-4b0f-b51b-00f15ffe6d5b)

In the image, it shows hover for `XExplicitTuple GhcPs`. We have

```hs
type instance XExplicitTupleTy GhcPs = [AddEpAnn]
```

so it should in this case show `[AddEpann]` too.

If it had an unconstrained type parameter in the hover context, it should show all the possibilities, so given

```hs
type instance XExplicitTupleTy GhcPs = [AddEpAnn]
type instance XExplicitTupleTy GhcRn = NoExtField
type instance XExplicitTupleTy GhcTc = [Kind]
```

It should represent this somehow, perhaps just showing the instances in the hover.

For bonus points, have "go to type definition" go to the appropriate definition (or list of definitions)

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.