breck7 / scrollsdk

Build on top of Scroll.
https://sdk.scroll.pub
379 stars 17 forks source link

💡 Designer Language Command buttons can be improved #137

Open breck7 opened 2 years ago

breck7 commented 2 years ago

https://github.com/publicdomaincompany/jtree/issues/120

I understand "Execute" and "Explain", but not "Compile".
A Tool Tip for these actions could be helpful.

Tooltips on each Command make sense. Additionally, if a language doesn't have an Execute or Compile Command than those buttons should be disabled.

A broader question is whether to take a little more time now and clean up this general command pattern. It feels like this should be a decorator pattern, rather than having each language overload an "execute" and "compile" method name.

These are all top level methods on the language root, so perhaps we have a common method like getTopLevelProgramCommands, and for now on the implementation side we could just reflect on method names for the suffix Command (perhaps the language agnostic way would be to add a commands field to Grammar for language nodes.

Designer could then iterator over all the custom defined top level program commands a language creator has defined, and then show buttons like: Compile to Javascript, which would call compileToJavascriptCommand().