monome / maiden

web based editor and repl for norns
GNU General Public License v3.0
47 stars 33 forks source link

identify (highlight/annotate) globals in the editor #125

Open pq opened 5 years ago

pq commented 5 years ago

this has come up a few times in conversation but i don't think there's an issue tracking. anyway, user trickyflemming on lines was snagged when overwriting metro:

I was finally bitten by the globals last night. I was working on a script and I created an array called metro. Hoo boy, norns did not like that. The error text was not useful so it took a bit of hunting to figure out what happened. I had to replace the offending variable, resave the script, and then reboot norns to fix it.

and suggested

One quick solution for the globals issue would be to add the globals to matron’s syntax highlighting. They could be a bright red to quickly show that they are not available variable names.

👍

see also: https://github.com/monome/norns/pull/426 and https://github.com/monome/norns/issues/425

pq commented 5 years ago

also worth possibly printing something useful in the repl on script load (discussion on https://github.com/monome/norns/pull/426).

i have some ideas for how this could happen while fixing the lagging lua syntax support #9; currently investigating!

also related: https://github.com/monome/norns/pull/436

mhetrick commented 5 years ago

I had another idea:

Currently, maiden has a red "X" that appears (almost too frequently!) on lines with errors or incomplete statements.

A yellow "!" would be useful on lines that contain redeclarations of or assignments to global variables. Mousing over this would provide a warning message that the variable exists as a global and that this could provide unexpected behavior.

pq commented 5 years ago

A yellow "!" would be useful on lines that contain redeclarations of or assignments to global variables.

👍

also maybe promising is to draw attention to the global functions you have (rightly) redefined because they serve as norns callbacks (, e..g., enc, gridkey, etc.) . in my head this is sort of like how "overrides" are decorated in the gutter of some editors, for example Java in IDEA:

image