-
Notifications
You must be signed in to change notification settings - Fork 35
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
Accessing fully qualified names when printing (for hyperlinking support in Alectryon) #330
Comments
Hi Clément. Sadly, I believe I had pretty much taken the unpleasant approach of re-implementing the pretty-printing myself for dealing with notations, and I don't remember having a good story on fully-qualified names. |
There is a plan to handle those properly, and some people have been already waiting for an embarrassing amount of time for me to finish the work :/ I hope I can get some cycles to work on this next week. |
Thanks Emilio! Looking forward to it. Ping me if you need help beta-testing :) |
Hi @cpitclaudel ,
I'm looking into this, what do you mean here exactly, how do you get those qualified names?
Umm, this should be possible, we do something similar in jsCoq using Definitively I'd like to extend Let's assume that for point 2, you either hack something with current annotations [as done in jsCoq], or you grab Let's go back to 1 then, unfortunately there is no good support for Coq to do this yet, but we can grab the So let's implement this and see what we get. |
Sorry, you're right, I don't actually get FQNs. I misread some output.
Sounds great. Also now that I think of it, I wonder if the best approach wouldn't be the following:
So the current output looks like this: Module Abc.
Definition xyz := 1.
End Abc.
Goal Abc.xyz + Abc.xyz = 1.
We have
🎉 Oh, btw, we can add Alectryon to the list of SerAPI clients now :) |
Oh, I see, actually the output here has qualids, because this is an AST synthethized from kernel terms; this also means that unfortunately locations are missing; I wonder how to add locations to a "reversed" term. You still have to resolve to qualids if looking at the regular, from-parser AST, but I think |
#72 should help with this. |
New config option `show_universes_on_hover`, that will display information about the universe graph for developer debug. Results seem a bit mixed, more research is needed. Fixes #330
New config option `show_universes_on_hover`, that will display information about the universe graph for developer debug. Results seem a bit mixed, more research is needed. Fixes #330
Finally Flèche can resolve symbols across a workspace. As of now this is used in:
Happy to expose this in more structured ways. |
Thanks! Is there a way to access that info from the LSP server? |
So I am not sure there is something in the standard that would fit Alectryon's use case exactly, maybe we could hack Not sure if LSP provides exactly what you would need. Adding a request Tho for Alectryon a small WDYT? I'd be happy to adapt to match in the best way possible Alectryon requirements. |
I'm almost certain that there isn't, indeed. Same issue as for breaking up the document into sentences.
Tricky, because I don't have the required symbol to start with (that is, I don't have symbol boundaries or a "point" to query information for, I just have the whole document.
What is FCC? But yes, that potentially sounds good.
The Lean backend uses LeanInk, but AFAIK it doesn't link to identifiers.
Ah, is there something shared between Coq and Lean for progress info? Neat. |
For that you can use
Oh, I was under the impression you had already the symbol at hand, as you were printing goals. How were you getting the info before? Both
I need to improve the info (I'm on it).
Thanks for the pointer, I'll have a look!
Not really shared, but I am trying to stay as close to the standard as possible, and after that, to extensions used in other systems, so I re-used their protocol implementation for that as I didn't see reason to deviate (see upstream LSP issue about ITPs) |
I need to run now, but I think it should be possible to write CoqInk using the Flèche API; recently a few people have shown interested in using Flèche's API in a similar way to Lean's API, and actually while Flèche needs to get a couple of adjustments, it should be possible to port Lean-based tools to Flèche quite fast. |
Thanks a lot, I will look!
I don't currently have hyperlinks :) Looking forward to adding them! |
I haven't looked at the API of LeanInk in depth, but that could be nice. |
Hi Emilio.
This is a follow up to coq/coq#4834 (comment) (thanks for the quick response!)
One thing Alectryon is missing compared to coqdoc is hyperlinking abilities. I'd like to (1) be able to link to definitions that appear in Alectryon blocks and (2) be able to link to documentation generated by coqdoc. To support this, I think I need to support two scenarios:
I have a bit of input code:
Definition x := 1.
; I need to realize that this defines the symbolMyFile.x
(in turn this probably means that I need to pass SerAPI a-topname
?I have a bit of input code (
Goal 1 + 1 = 2.
) or a bit of output (1 + 1 = 2
, part of a SerAPIGoal
); I need to realize that "+" isCoq.Init.Nat.add
.I can almost get this information with SerAPI If I ask for CoqSer output (it gives me fully qualified names, which is great). But CoqSer results don't include info on notations, so I can't produce pretty-printed hyperlinked output with that.
There's also CoqPp output, and there the Pp_tags that say things like "notation". But there are no tags for FQNs.
Maybe we could have a separate mode that returns CoqPp structures with meta information in new
Pp_Tag
s? (But then I'd have to reimplement the box layout algorithm on my side). Or maybe we could return meta info for spans of formatted output (but that might tricky to implement?). Or maybe there's something completely different that I didn't think of?Going the annotated Pp_tag route means that we can also include stuff like syntax-highliting information with the same mechanism at a future point, which would be pretty sweet.
Looping in @Ptival who has stuff like this working on top of jsCoq in his cool online demo in the past.
Hope you're doing well!
Clément.
The text was updated successfully, but these errors were encountered: