-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: jump to definition proof of concept #911
base: main
Are you sure you want to change the base?
Conversation
Changes to coq look good too. |
That logic is on the loc -> pp side though, vscoq only calls the qualid -> loc part from coq and does the rest on its own. |
match get_context st o_pos with | ||
| None -> log "No context found"; None | ||
| Some _ -> | ||
match parse_entry st loc (Pcoq.Prim.smart_global) pattern with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match parse_entry st loc (Pcoq.Prim.smart_global) pattern with | |
match parse_entry st loc Pcoq.Prim.qualid pattern with |
since you're only using the AN
case of smart_global
It may still make sense to have the api on the coq side and let vscoq call it on the loc, no? Anyway, good job! |
I do not know if it's feasible, but as a user that would be fantastic if possible. Company-coq does indeed jumps to dune source, and it has always been a major pain. |
I guess in the meantime something that works in most cases but not all is better than nothing? |
begin match Nametab.locate qid with | ||
| ConstRef x -> begin match Declare.get_loc x with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need updating as I moved get_loc and made it apply to more than constants
something like
begin match Nametab.locate qid with | |
| ConstRef x -> begin match Declare.get_loc x with | |
let extref = Nametab.locate_extended qid in | |
match Nametab.cci_src_loc extref with |
should work
Not sure how well this works with an editable document, I mean start with (* some comment *)
Definition foo := 0.
Check foo. evaluate the Definition, then edit the comment, then jump to def of the if editing the comment doesn't force re-evaluating the Definition then the loc will be wrong, but we don't want to re execute after editing comments (or whatever other edits we can detect as being trivial) |
That is certainly true, although it seems a minor problem in practice. I'm thinking loud here: if we manage to perform some pieces of the globalization phase at parse time, then parsing "Definition foo := ..." could tell us that we will generate In a way, since the map is about locs, it should be part of the parsing state, not the interp one. |
That's impossible IMO
The map is about objects like globrefs which are part of the interp state. |
AFAIK synterp already computes the current modpath. From that one can compute the final KN of "foo". Am I missing something? (I know today the kn data type is generated using the env, etc... but in principle we know all the data to compute it even without the env) |
WIP
cf coq/coq#19584