-
Notifications
You must be signed in to change notification settings - Fork 218
feat(dhall-docs): Jump to definition on let bindings #1966
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
Conversation
|
@sjakobi I tried your suggestion of splitting out the |
|
@german1608 Where do I find examples of this feature in action? When I try opening the golden HTML files in my browser I only get a blank page.
No worries. It was just an idea – it's not a priority. |
Check the generated docs on hydra for Prelude. The golden files can't be displayed on the browser because of a bug in the HTML prettyprinter |
Do you mean https://hydra.dhall-lang.org/build/68681/download/1/docs/? I can't find any docs that look changed.
That needs to be fixed. Can you record an issue? We could even consider removing the pretty-printing step. |
Check here for example: https://hydra.dhall-lang.org/build/68681/download/1/docs/Map/keys.dhall.html
Sure. The pretty-printing step it's nice to have a better diff view when there is a failure. |
|
@sjakobi I've just noticed that I forgot to push the update for prelude docs, the link we had earlier is outdated so you should refresh it |
sjakobi
left a comment
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.
Jump-to-definition works really nicely in https://hydra.dhall-lang.org/build/68717/download/1/docs/JSON/renderAs.dhall.html. 💪
I think the feature is a bit hard to discover though – it would be nice if declarations and uses would be highlighted a bit.
I don't currently understand the problem with backticked variables. Why does the way they appear in the source code matter? Modulo shadowing, all you need to match a variable to its binding is the text in Var.
BTW, did you get variable shadowing right? E.g.
let a = 1
let a = 2
in a
Here the last a should only reference the a = 2 binding.
A test would be good to have for this.
And what about
let a = 1
let a = 2
in a@1
?
|
Sorry for the late review BTW. I'm pretty busy with non-OSS things this week. I hope I'll have more time next week. |
sjakobi
left a comment
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.
LGTM! I'd still like to see some highlighting of the linked variables, but it's not urgent.
Gabriella439
left a comment
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.
Very nice job! 🙂
@sjakobi: the variable highlights when you put the mouse over it (hover it). Do you mean to highlight it in some background all the time? |
Now when the user clicks on a variable declared on a let-binding it will jump to that location. If it hovers it, it will highlights all the usages.
cdeb756 to
2f19677
Compare
Yeah. I thought it would be nice if those parts of the code that are not just boring text would be highlighted a bit. Currently, I think this feature is a bit hard to discover. |
Ok! I'll do some UI/UX fixing in a further PR |
Summary
This PR adds jump-to-definition on let bindings. It is really similar to haddock's:
I also updated
dhall-docs-gen.nixwith the latest changes from dhall-lang'sPreludeSolution
Check the header of
Dhall.Docs.CodeRendererfor a high-level explanation of how the code is rendered.To discuss
I left some
FIXMEs comments on the code about how we handle labels that are quoted using backticks. To solve those I was thinking we could do the following:bindingSrc0andbindingSrc1to generate the actual label.Bindingdata type to something like this:valuereferences (PTSD of feat(comments): support prefix comments on Record's key-value pairs. #1908)Let me know if you have any idea or if you like any of my above proposals.