Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jump to instance definition and explain typeclass evidence for GHC 9 #1983

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wz1000
Copy link
Collaborator

@wz1000 wz1000 commented Jun 26, 2021

Now that we have GHC 9, it is easy to implement "Jump to instance definition" as well as show exactly
the instances being used at a point on hover.

Hover

Jump to definition

TODO

  • Extend to references - UI is a bit tricky here
  • Improve markdown rendering - @isovector did you figure out how to have inline syntax highlighting yet?
  • Fix tests
  • Clean up CPP?

@pepeiborra
Copy link
Collaborator

pepeiborra commented Jun 26, 2021

Not strictly related to this change, but I wonder if it's possible to show the instances in scope when hovering on a type?

@isovector

This comment has been minimized.

@wz1000
Copy link
Collaborator Author

wz1000 commented Jun 26, 2021

Not strictly related to this change, but I wonder if it's possible to show the instances in scope when hovering on a type?

Yes it is. In fact, local completions will already (incorrectly) suggest local instances in scope (i.e. those arising from type signature contexts and case splits) if you start completing using $d.... I will fix this now.

For top level instances, we can use the same mechanism used by GHCi for :instances.

@wz1000

This comment has been minimized.

@wz1000
Copy link
Collaborator Author

wz1000 commented Jun 26, 2021

Some opportunities for bikeshedding:

  • We can probably do away with the top level bullet point
  • "defined using"/"constructed from"?
  • "evidence of constraint" or simply "evidence" or even "dictionary of type"?
    • Maybe omit the words "evidence of constraint" etc. from all the lower level bullet points as it is just noise at that point

@pepeiborra
Copy link
Collaborator

Some opportunities for bikeshedding:

  • We can probably do away with the top level bullet point
  • "defined using"/"constructed from"?
  • "evidence of constraint" or simply "evidence" or even "dictionary of type"?

"from instance", "via instance" or simply "instance"?

  • Maybe omit the words "evidence of constraint" etc. from all the lower level bullet points as it is just noise at that point

+1

@wz1000
Copy link
Collaborator Author

wz1000 commented Jun 26, 2021

"from instance", "via instance" or simply "instance"?

It is not always an instance, see for example:

2021-06-26-210629_grab

@isovector

This comment has been minimized.

@isovector

This comment has been minimized.

@pepeiborra
Copy link
Collaborator

@wz1000 are you planning to land this soon or could someone else work on it?
@July541 would you be interested in wrapping this up?

@July541
Copy link
Collaborator

July541 commented Aug 29, 2021

It's a very practical function! I'm glad to push it far more with @wz1000' willing.

BTW, have this feature been integrated into hiedb? Call hierarchy can also jump to the corresponding instance with this.

@jneira
Copy link
Member

jneira commented Sep 1, 2021

Needs a non trivial (for me :-P ) rebase

@wz1000
Copy link
Collaborator Author

wz1000 commented Sep 2, 2021

@July541 yes, feel free to pick this up. hiedb to some extent will "just work" with these changes, but it may also need some special support somewhere depending on what exactly you need to do.

@July541
Copy link
Collaborator

July541 commented Sep 6, 2021

@wz1000 Hello, do you mind explaining some details?

  1. For Extend to references, what should it be? Should it remove irrelative instances?
  2. What should improve in markdown?

@Anton-Latukha

This comment has been minimized.

@Anton-Latukha

This comment has been minimized.

@Anton-Latukha

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: unfinished Status for PRs that have been semi-abandoned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants