-
Notifications
You must be signed in to change notification settings - Fork 546
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
Go-to-definition on typeclass method should go to instance #1722
Comments
👍 for the go-to-instance feature, this is often requested.
Actually, I think it goes to the notation. And go-to-definition goes to the macro expander. At least for Generally speaking, there are multiple items we want to go-to (for
Another question is what counts as a "typeclass method". (Should it work on |
I'm looking into this. In the Would a fundamental fix here be to make |
I don't think we need to change the info tree for this. From the existing |
Thanks for the pointer. Since this will be very much immediately useful, I'll put something like this together right away. But I wanted to ask more about the expected behavior here in the long term. If you go-to-definition on So in the case of a projection of a struct-like class couldn't we normalize the field of the instance corresponding to the projection before searching for candidate constants for go-to-definition? And we could bundle everything else (TC instances, syntax, etc.) under go-to-declaration/go-to-type. This would remove two levels of indirection in the common case (first for the user to sift through the go-to-definition list and select the base instance, and second for them to find and go-to-definition on the correct field in the instance). |
I just remembered a basic issue we discussed in the frontend meeting: how do we decide whether a macro fundamentally stands for a typeclass method invocation or simply, accidentally ends with one? We already had a question about this for the existing hover/completion: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Term.20Macro.20Docstrings. The good thing is that we now have canonical synthetic info to differentiate between these two cases. So we could limit this " But really when opening this issue I wasn't thinking about notations at all, so doing this only for nodes with original info would already be a good start. |
...while go-to-declaration should go to the typeclass as it does right now. I hope that's not too controversial (and may even have been suggested before)? Note that you can still move from the instance to the class by using go-to-definition on the method name again.
The text was updated successfully, but these errors were encountered: