Makeshift REPL plugin function tester

msfp

A really unstable QML javascript function tester:

  • Autorun REPL (Read Eval Print Loop) editor using the eval( ) function, which is unsafe/unstable.
  • Dumb autocompletion (TAB) that shows all keywords.
  • Indent (TAB) and auto-indent (SHIFT-TAB)
  • Comment (Ctrl+ / )
  • Temporarily disable autorun upon detection of curScore.endCmd( ). Click the H button to run once and then force autorun (turns into a blue A), click again to disable autorun. So essentially double click on it to run once now only.
  • Edit autorun idle timer, and shortcut keys inside .html; Edit keyword list inside ms3plugin-hint.js (feel free to share your work)

Warnings

  • Backup scores; also save data and close other running programs BEFOREHAND.
  • Closing (and reopening) plugin window creates duplicate background components that hoard RAM and CRASH WINDOWS, use "Windows Task Manager" to see them. Restart Musescore to kill hidden components.
  • Loss focus of the editor after running curScore.endCmd( )

Ways to crash Musescore

Download musescore_makeshiftrepl_20230223A.zip

May not run on platforms other than Windows.
Install: how-to
Enable plugin: how-to

Demo

Diff an element

clearlog();log(Date());log('');
if(!last) var last
function r(){
  var map=function(o,f){for(var i in o){f(o[i],i)}}
  var shallowcopy=function(x){var o={}; for(var i in x){ o[i]= x[i] }; return o}  // no Object.assign in QML
  var es=shallowcopy(curScore.selection.elements[0])
  map(es,function(e,i){
    if(!~[
           'function'
          ,'undefined'
          ,'object'
          //,'boolean'
          //,'number'
          //,'string'
         ].indexOf(typeof e)){
      if(last&& e!=last[i]) log('i :'+i+',e :'+e+',last[i] :'+last[i])
    }
  })
  last=es
}
r()

Dependency and credits

JS library Codemirror 5

Languages

HTML, CSS, JS, QML (WebEngine, WebChannel)

Old versions

musescore_makeshiftrepl_230217A.zip
musescore_makeshiftrepl_230207A.zip
musescore_makeshiftrepl_230204D.zip
musescore_makeshiftrepl_230204C.zip
musescore_makeshiftrepl_230204B.zip

Feedback

Found a bug, have suggestions or just wanna give me thumbs up 👍? Chat in this forum thread

License

None. See dependency and credits. Do whatever you want to, no need to ask for any permission. Glad to share a link to your improved plugin on this page, just let me know.

Issue Tracker

API compatibility
3.x
Plugin categories
Other