I’m sure many programmers out there have found the ability to collapse big chunks of code into a single line very useful in other text editors. I think this functionality should be made available for Sonic Pi.
If you’re not sure what I’m talking about I’ll explain it as best I can. In the text editor “TextWrangler” (as well as many others) the user can highlight as many lines of code as they desire. They can then right click and select “collapse” from the drop down. This will in turn collapse the many lines of code into a single line of code with a symbol that looks like this “[…]”. Is the user wishes to uncollapse the code they simply can click on the symbol.
Another thing I noticed Sonic Pi doesn’t have is a simple Find feature that would typically be triggered by “command-F/ctrl-F” which allows the user to search for a keyword or value as well as replace keywords/values. This I believe would result in much faster editing during live coding.
I don’t agree, since the ability to immediately run what you wrote or changed is pretty essential in using Sonic Pi. Can’t do that in another editor. I too think it would a small feature which would greatly enhance Sonic Pi.
It might be a small feature to conceive, but it’s not small to implement and while it’s on my todo list it’s not as high as other things.
We’d need to carefully consider the interaction design of a simple search system. I’m not a fan of complex pop up boxes and lean towards a vim/Emacs approach of using a command line to initiate a search.
If anyone wants to have a go at implementing such a thing that would be ace.
Well, putting aside the question whether you want to use something outside of SP at all (with possible drawbacks), you can use Emacs (or Atom, but I never tried that). I find myself using both, Emacs and the native Sonic Pi editor depending on purpose and context.
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-ruby",
tabMode: "indent",
matchBrackets: true,
indentUnit: 2,
lineNumbers: true,
value: "#foo",
//add these lines to get code folding
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
});
i don’t know if this actually works, since i guess you might need to recompile it or something. i don’t see the codemirror part when i do the show package contents, so i don’t know how it gets put in to the one that you download. so, someone else might know that part. but if that’s how it works, then this might get the code folding!
Certainly looks interesting… I was looking at Notepad ++ plugins myself earlier on this evening and
wondering how hard it would be to write an ‘SP’ plugin… there are already numerous ones that add menu
buttons and/or export via clipboard. or execute documents as files in their default environment / applicaton.
Sorry to lead you down the wrong track, but the gui/html folder is for the prototype HTML editor I built a long while ago which drastically needs some love. Unfortunately that’s not used at all in the regular GUI which is built in C++ using Qt (and can be found in the gui/qt folder).
thanks, @samaaron! (and thanks for building sonic pi in the first place!) good to know that’s the setup
well, if the html editor gets put in use, then maybe i can help out with something. at least adding or modifying little things i can get by. more complicated things, like c++, are a little beyond me. (though i found out about qml recently, and that’s actually pretty neat. i like that the interface builder looks a little like photoshop)