monome / maiden

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

consider server-side lua syntax checking and analysis #135

Closed pq closed 4 years ago

pq commented 6 years ago

maiden uses a customized ace editor mode to provide an editing experience tailored to lua for norns. out of the box, ace provides basic client-side syntax highlighting and a web-worker-based syntax checker. though we've done a bit of customization already, there's a limit to how much we can change practically. notably, the syntax checker is not easily enhanced or replaced and even trivial changes to the parser are tricky to integrate (see: #9) .

work on the client-side has more fundamental limitations as well. doing semantic analysis in the browser (to provide, for example, awareness of norns functions or offer lua linting) is not practical. nor is rich code transformation (such as formatting or refactoring).

as alluded in #125, i've been playing with some ideas and have them far enough along that i'd like to open up a proper conversation. my WIP, called "scry" is up here:

https://github.com/pq/scry

it demonstrates server-side static analysis and linting and on-demand lua formatting.

the scry server is tiny and mostly lua, leveraging two lua libs: luacheck for static analysis and lcf for formatting (both are small and seem stable); it's wrapped in a small node server. were scry to be integrated into norns in a first class way, i'd imagine scry would run along-side matron and crone in much the same way (e.g., using ws-wrapper or similar, but certainly not node).

needless to say thoughts and considerations welcome! 👍

pq commented 4 years ago

as enamored with this idea i am, i think it's best to close for now. if there's interest, we can re-open and i can dust off my scry prototype.