haskell / haskell/haskell-language-server

Implement "Go to implementation" request for type/data families

Open
#4,655 0 comments 2 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
4d 3h
Merged PRs (30d)
12

Description

## Is your enhancement request related to a problem? Please describe.

"Go to implementation" already allows to jump from the use site of a class method to the implementation of the class method (if a specific instance is used).

It would be extremely useful, to also jump from the use site of a type or data family to the implementation of that type or data family (if a specific instance is used).

Using the classical example of a list-like data family:

``` haskell
-- Declare a list-like data family.
data family XList a -- [1]
-- Declare a list-like instance for 'Char'.
data instance XList Char = XCons !Char !(XList Char) | XNil -- [2]
```

A possible use site could be

``` haskell
toString :: XList Char -> String
toString = _
```

If the cursor position is on `XList`, we can jump to `[1]` using "Go to definition".

## Describe the solution you'd like

However, many times, especially in more complex code bases, the definition of the data family `XList`, and the definition of instances are far apart, and we want to jump to the implementation `[2]` of the instance for `Char`. This would be done using "Go to implementation", but does not yet (?) work in these cases.

## Describe alternatives you've considered

None.

## Additional context

You tell me!

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.