VS Code extension

@ethancrawford, I will commit a new version later today that gives 4 options to configure this as you like, including the those 2 that you mention (just one custom extension for now). My plan is that it will even prompt you if you have selected custom extension but forgot to put which one.

1 Like

Ok, the new version just committed to master has some improvements:

  • Configure when to start the server automatically (4 different option): always, on ruby, on custom extension or never (and a new command to start the server, of course…)
  • New snippets for synths, samples, effects
  • Better default (hopefully) for root path based on platform
  • A basic CI service on github to be able to go through Pull Requests quicker (just 1 PR for now, but I hope there will be more in the future)

Feedback will be appreciated, I am interested in whether the root path improvements are good, and also about your experience with the snippets for auto-completion.

1 Like

Trying under linux ubuntu 18.04.04, sonic pi from source but not recent sources :slight_smile:

Try to find my path to indicates the ruby_path in your src/main.ts as i don’t have some

would you please tell me which path i have to look for ?
and would it be better if i try to use the latest version of sonic-pi (but have to compile from sources since ubuntu 18-04-04)

Can you try to set it to just “ruby”, without rootPath or anything else? I think in Linux it is using the native ruby.
And if that does not work to “/usr/bin/ruby”?

Since the changes to auto path for Sonic PI and ruby I have had problems with my mac install. When I press f5 it starts to try and run but I get the error
Activating extension 'Luis Lloret.sonicpieditor' failed: Cannot read property 'forEach' of null.
which is not particularly helpful. I’m a newbie to the the vscode interface and not found out (yet) how to sort this. I’ve moved my Sonic PI so that it is in the Applications folder and I think the paths are correct.
Not sure where I sepcify what the start method is (and whether that is the problem?) Where is this changed?

@robin.newman, I am going to upload to master in the next couple of hours, and I have made some improvements around that area. It would be great if you can give it a try then.

Also, high on my priority list are improvements to the logging when things do not work as expected.

The error you are getting is quite likely a bug, which is triggered by the code trying to iterate on an null object (where there should be an array).

I’ll let you know when the new version is in master. Thanks for your patience…

@robin.newman, I just updated in master. If you can, give it a try and let me know how it goes. This version has a setting to put the root path if the default does not work. Hopefully that will help.

Thank you.

I updated and ran again with the same problem. I set a breakpoint in main.ts line 103 and looked at local variables. It seems to be using the original value wher I previously had sonic pi installed but it is moved from their to Applications and renamed to Sonic Pi
How do I clear any data from previous runs and get it to re-evaluate.
eg for FetchUrlPath it had:

"/Users/rbn/Downloads/Sonic Pi 3.2.2release.app/Contents/Resources/app/server/ruby/bin/fetch-url.rb"

@robin.newman, you can use the vscode command “Preferences: open settings (JSON)”, and then delete the line where it is set in the json file.

Not sure if that’s what you are asking, though.

some how npm had gone adrift. In the end I reinstalled rom scratch and working fine now.

Ok, I just updated master with better path checking at the beginning, and some code cleanup. Now it will check if the Sonic Pi root path looks ok, and if not, it will prompt to update in the settings.

Hi, if you have any feedback regarding the extension so far, I’d love to hear it.

I am also very interested in hearing about what you think the next features to implement should be.
Thank you!

Yes it works but

ok so what should i do to set the correct path ? How to edit right there ? double click > no. Left click nope.

There should be a textbox just below what you are showing in the screenshot, you can enter the proper path in there:

Thanks for your answer and for your work.
No line appears to put the correct path but maybe this issue is due to my visual code version (visual code insiders). Maybe not the latest. I’ll try again tonight.

ok so under windows 10, no pb.


IMHO, the next step is to have access to the options for each command. As example, if i choose fx, i wish then to have an help to show me what options are available in this context.

second point :slight_smile:


  • should have first maybe the synth (SonicPiEditor)

Third wish :slight_smile:

i wish all the commands starting with use to be proposed (use_bpm etc…) as in sonicpi.


I do understand there is a huge amount of work to achieve to obtain this feature but you ask us to give you some ideas so… :slight_smile:

ok so the line is there but maybe put a more visible background :slight_smile:
But how to save this parameter ?

EDIT : Ok just Enter :wink:

So good news your extension works under Linux !

Hi, @nlb, thanks for the feedback. Great to get confirmation that this works under Linux. I am working on setting up my Linux VM environment and I’m quite close.

Some comments

Not sure the extension can control the order in which vscode presents this list.

Agree, but not sure what the best way is to do this apart from snippets…

This is controlled by the theme you have on Sonic Pi, nothing extension developers can do about it, AFAIK.

Thanks again!

I just wanted to bump this thread thanking @luislloret

Discovered live coding music today and it’s truly incredible, and was amazing to find a VS Code extension (which seems to have popped up fairly recently too!)

As a contribution, I added toggleable live-reloading support to it and some notes from the Linux/Ubuntu setup process for any other Linux friends out there.

Would be great to get a basic Language Server Protocol implementation for symbol resolution done so that it had a provided list of Sonic Pi function names at the bare minimum too.


First time poster here, also just wanted to say that this is a great initiative!

What additional work is necessary to:

  • get this on the Extensions Marketplace?
  • add visualizations? :sunglasses:

I also fiddle with TS, I’ll chip in a PR or two if I see anything I can help with! :smiley: