Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Show hint when you click on a global without Ctrl down

Open fonsp opened this issue 2 years ago • 7 comments

In some recent screen-sharing sessions with Pluto users, I found that the Jump to definition feature is too hidden: people don't know it exists, or they forgot the keyboard shortcut.

This PR will pop up a hint if you click on a global without Ctrl down.

What do people think about this?

See also these two other PRs, which will be merged soon:

  • https://github.com/fonsp/Pluto.jl/pull/2450
  • https://github.com/fonsp/Pluto.jl/pull/2452

https://user-images.githubusercontent.com/6933510/213256615-8cbcddaa-cdf4-4b0c-ace0-1a607a7a5e08.mov

TODO:

  • [ ] As the popup's source_element, I used the codemirror line element, not just the identifier element. I did this to make the popup show next to the editor, instead of on top of the line. BUT: now you need to click outside the line to hide the popup, clicking somewhere else within the line leaves it open. That does not feel nice.
  • [ ] It feels a bit intrusive, as it will show up quite a lot during regular use, triggering a fancy animation and taking up a bit of surface area each time. Maybe the hint needs a more subtle style. Do others agree?

fonsp avatar Jan 18 '23 17:01 fonsp

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="jump-to-definition-tip")
julia> using Pluto

github-actions[bot] avatar Jan 18 '23 17:01 github-actions[bot]

I agree that it might quickly become too distracting. Would it be possible to have a "do not show again" (even when restarting the Pluto server) ? Maybe as a cookie ?

ederag avatar Jan 23 '23 18:01 ederag

Another stance could be to only show the wiggling underlines (that make the variable a link) when Ctrl is pressed. This way, the first time the user hits Ctrl, it should be clearer that something new can be done. And the code display would be cleaner (those underlines slightly alter my reading) when Ctrl is released.

ederag avatar Jan 23 '23 18:01 ederag

Another stance could be to only show the wiggling underlines (that make the variable a link) when Ctrl is pressed. This way, the first time the user hits Ctrl, it should be clearer that something new can be done. And the code display would be cleaner (those underlines slightly alter my reading) when Ctrl is released.

Thanks for the feedback! This was exactly my thought when I made the underlines bright pink when you press Ctrl! 😅

fonsp avatar Jan 23 '23 20:01 fonsp

This was exactly my thought when I made the underlines bright pink when you press Ctrl

:rofl: Being so used to the effect, I forgot about it !? Maybe the effect would be stronger if the underlines were normally invisible ? (a change of color is not as strong as something appearing)

ederag avatar Jan 24 '23 08:01 ederag

:) I like the fat underlines, since globals play the lead role in our reactivity. But good to hear your feedback! I will take it into consideration the next time this is up for a restyle.

fonsp avatar Jan 24 '23 11:01 fonsp

I like a lot that globals stand out visually!

greimel avatar Feb 04 '23 16:02 greimel