geoffroymontel / supercollider-package-for-sublime-text

A SuperCollider package for Sublime Text 2
22 stars 12 forks source link

Sending one line at a time? #4

Open starakaj opened 12 years ago

starakaj commented 12 years ago

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.

palinka commented 12 years ago

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"} }

geoffroymontel commented 11 years ago

Hello

You can select multiple lines starting with a { and evaluate

monomon commented 11 years ago

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.

geoffroymontel commented 11 years ago

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

monomon commented 11 years ago

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