-
Notifications
You must be signed in to change notification settings - Fork 74
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 definition #214
Comments
Is there a way to get the current loc from declare-ish?
That's not necessarily unique, we should ask where the file is mapped from instead For functors Module F(A:T).
Definition bla := ...
End F.
Module M := F X. looking up If we want to have an additional pointer to the |
I did some "experiments" with this idea in Coq-Elpi (using a few hacks on top of 8.13). This is what I could get in the context of the IMO, at least for the easy case of Definition/Lemma and Inductive, we can try to add this libobject. WDYT @SkySkimmer ? |
It makes sense to me. I guess you used Proof of concept: coq/coq@3f02b36 (note that the test suite output/ rewrites all filenames to "stdin" for some reason) |
This would help a lot to get vscoq on par with what is typically expected in a modern IDE. :) AFAIK there are ways to get jump-to-definition in emacs with Company Coq, or did I imagine that? Could vscoq use the same approach for this? |
Iirc there is a way to open the file, and maybe there is code already for that. Going to the correct line requires some work, even if the outline (on the left panel) can jump to any definition within the same file. |
I am following the software foundation books right now and have to say that being able to jump to a definition/lemma would be great. There are often multiple consecutive definitions of the same thing (in different modules) for teaching purposes and being able to quickly jump to the one referenced (and thus also the related theorems that are defined around it) would be very useful. It is also kind of an expected feature in modern IDEs, as mentionned above. |
This was closed by #911 |
we need a libobject which populates a map kername -> loc (where loc contains a file name relative to the logical path)
mathcomp.ssreflect.ssrnat.len -> mathcomp.ssreflect + ssrnat.v + loc
Coq.Init.Peano.le -> Coq.Init + Peano.v + loc
The one asks Coq where the logpath is mapped from, eg mathcomp.ssreflect -> $coqlib/user-contribs/mathcomp/ssreflect/, and the can generate the link file:///$coqlib/user-contribs/mathcomp/ssreflect/ssrnat.v
The libobject should be a bit down, since we also need to get links to generated stuff, eg foo_rect (and point to Inductive foo).
In response to the request
https://microsoft.github.io/language-server-protocol/specification#textDocument_declaration
one (re)globalized the AST we have in the document module, gets the kernel name, looks it up in the map, and generates the link.
It is not always possible to "globalize" a vernac, since sometimes (eg Inductive/Record) it is messed up with interpretation.
Possibilities:
repeat t
returning a gazillion of hitsThe text was updated successfully, but these errors were encountered: