supercollider-package-for-sublime-text icon indicating copy to clipboard operation
supercollider-package-for-sublime-text copied to clipboard

Sending one line at a time?

Open starakaj opened this issue 13 years ago • 5 comments
trafficstars

Evaluate current line isn't ideal, since it makes it impossible to define multi-line functions and because the analogous command in SuperCollider proper reads "Evaluate Selection". Would it be possible to change the sublime text command to send the current selection, rather than the current line? It looks like it would be as simple as not sending a newline character for every line, but rather at the end of the selected block.

starakaj avatar Aug 16 '12 21:08 starakaj

An "Evaluate Section" command (which doesn't change the cursor position) would be great! I took a fast look to the macro-system sublime offers and ended up with:

[ {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "expand_selection", "args": {"to": "brackets"}}, {"command": "sc_send", "args": {}} ]

This selects some regions, but the evaluation doesn't work: "Unknown macro command sc_send".

Stuck here and I doubt macros are the way to go.

Just FYI: in Keybindings - User:

{ "keys": ["f5"], "command": "run_macro_file", "args": {"file": "Packages/User/SuperCollider Marco.sublime-macro"} }

palinka avatar Sep 01 '12 21:09 palinka

Hello

You can select multiple lines starting with a { and evaluate

geoffroymontel avatar Oct 16 '12 15:10 geoffroymontel

Hey Geoff, first of all thanks for the plugin - I am a recent Sublime convert and needless to say I would like to use SuperColllider (for my thesis :)) in ST, too.

I was looking at the Gedit plugin, it doesn't split up the lines, but instead calls bytes(text) before passing the selection to stdin. This might work... I will give it a try.

Let me know what you think.

Unfortunately wrapping in {} doesn't work.

monomon avatar Jun 24 '13 11:06 monomon

OK ! Let me know if it's working better this way :) Cheers

geoffroymontel avatar Jun 24 '13 12:06 geoffroymontel

In fact, all you had to do was remove the shell=True option in the Popen constructor :) works like a charm

monomon avatar Jun 24 '13 20:06 monomon