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

📎 Dynamic code hints: warn when creating a multiple definition

Open fonsp opened this issue 3 years ago • 11 comments

https://user-images.githubusercontent.com/6933510/151268574-6e102be9-b3f9-43ef-9d27-938725ccadcd.mov

The warning system is more general, and can be used for other syntax-matching hints.

TODOs:

  • [ ] Methods warns (canonicalize on the frontend ?)
  • [ ] Merge lint gutter and line number

fonsp avatar Jan 27 '22 00: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="warn-double-definitions")
julia> using Pluto

github-actions[bot] avatar Jan 27 '22 00:01 github-actions[bot]

Very cool! :fire: may be a good use case for @codemirror/lint. what do you think ? linter

https://github.com/fonsp/Pluto.jl/compare/warn-double-definitions...warn-double-definitions-codemirror-lint

Pangoraw avatar Jan 28 '22 20:01 Pangoraw

ayyy, it even knows about DataFrames! (just function calls in general?)

using DataFrames
hello = 123
DataFrame(hello = rand(10))  # All good in the neighborhood

although it will grumble while in the process of making a named tuple, but maybe that should be preferred?

https://user-images.githubusercontent.com/25312320/151625577-e84a84a1-10ed-444f-b37c-0e0287dbac60.mp4

icweaver avatar Jan 28 '22 21:01 icweaver

This is now merged! https://github.com/fonsp/Pluto.jl/pull/1859#issuecomment-1024611774

fonsp avatar Feb 10 '22 18:02 fonsp

disabling

i am looking into overlaying the warning gutter with line numbers. (disabling https://github.com/fonsp/Pluto.jl/pull/1859/commits/6892d7aa115965b7e1f81f40983ba93c4ad98a45 in multiple definitions can be moved to another pr)

Pangoraw avatar Feb 15 '22 18:02 Pangoraw

frontend tests will give ✅ again if you update from main!

fonsp avatar Feb 15 '22 22:02 fonsp

Awesome work! This is great for people on a touch screen (can't hover)

fonsp avatar Feb 15 '22 22:02 fonsp

Wait...... did you just secretly fix #1386............ WOW

Can you put that on main? Amazing!!

fonsp avatar Feb 15 '22 22:02 fonsp

Wait...... did you just secretly fix #1386............ WOW

Can you put that on main? Amazing!!

there is still a sync bug (when you re-enable a cell), i'll update when #1895 is merged

Pangoraw avatar Feb 15 '22 22:02 Pangoraw

Cool! What do you need from that PR? Or just avoiding merge conflicts

fonsp avatar Feb 15 '22 23:02 fonsp

@Pangoraw can you move the backend changes to a new PR? Did you say that it has performance issues, or was that about something else?

fonsp avatar Mar 29 '22 12:03 fonsp