Cabbage Logo
Back to Cabbage Site

Cabbage as primary IDE

Hey Rory

I’m starting to use Cabbage more as a main IDE (I’m realising the benefits of the patcher!), and there are a couple of features that would be great, maybe they already exist?

  • Syntax highlighting for ORC files - Is it possible to enable this? I like to split up big files now (#include is coloured interestingly)
  • More key commands for code editing - kill line, select line, move line up/down etc
  • Evaluate section/line - this is a great feature of CsoundQT

Any of this easily doable?

Many thanks

I just added this. What OS are you using?

I could…but then I think I would have to also add a keyboard shortcut settings dialogue in the Cabbage settings window, which would be a bit of work. It is something I’ve been putting off so some time. But perhaps it’s time…

Tell me more about this, how did it work?

I’m on Mac OS

Hah, a can of worms! Hard coded shortcuts would be fine too obvs. All the code editors I use (VS Code and Sublime) seem to adhere to common shortcuts.

So it is useful for live coding styles - say you had a sequence running, you can re-evaluate an instrument (section evaluation) on the fly. Similarly you can instantiate (or remove) instrument events on the fly (lines evaluation). Internally I believe it uses the compilestr opcode to re-compile to the running Csound instance. Basically is pretty handy to be able to make changes and hear them in realtime, without stopping/restarting the patch.

I’ll certainly take a look at the standard keyboard shortcuts for this. The JUCE based editor I use is not the best, so all of these kind of things have to be manually implemented. It’s not the hardest thing in the world, but I just wish I had a better text editor class to work with.

Now you’re talking real can of worms! This is certainly something I would have to think long and hard about before implementing.

How? Simply select the text and hit evaluate? How about p-fields? What values are passed for them? And if the entire orchestra is already running does this kill the last instance of an instrument, or add another instance to the tree? I think the subtle differences in how one uses CsoundQT and Cabbage come into play here, but I’m certainly not opposed the idea.

I did a perfunctory search on the matter this morning and came across https://forum.juce.com/t/a-modern-code-editor-for-juce/28233/7 I scrolled down and lo-and-behold there you are :joy:

gawd I certainly don’t want to distract you from more interesting things

It’s just as you would normally write in the orchestra, just not using the score.

schedule(1, 0, 3) if the instrument is not running (Cmd+Shift+E) would instantiate instr 1 for 3 secs

instr 1
  outs(poscil(1, 300), poscil(1, 301))
endin

put the cursor in between the instr/endin (which denotes a section, likewise for opcode/endop) and Command + Shift + W would re-evaluate it, and you’d hear the changes in the next instantiation of the instrument.

Best explained but giving it a go really. It’s much like the SuperCollider server node model.

You can see from my post to that thread that I was following this too, but development has stopped. It seems more like a proof of concept that a replacement for the JUCE editor. If I am going to replace the current editor it will be with a fully functional replacement. If I switch to this one I would still have to manually code most of the functionality. :nauseated_face:

That would be fairly simple to implement. Although hitting save will have the same impact? I"m a little wary of adding features like this. They are no doubt cool, but for the work involved, I’m not sure how useful they are in practice. But it might just be down to how I use Cabbage. I usually have an instrument running continiously in the background. I can’t remember the last time I actually stopped one!

Fair enough man, I probably need to get more used to the Cabbagge workflow

interesting, but if you make changes to it, you just save and it re-instantiate to hear the changes?

Yeah, just hit save whenever you want to update and hear changes. :+1:

crazy :grinning: