VS Code extension

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:

@luislloret,
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.

image

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:

image

  • 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.

image

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.

2 Likes

@luislloret
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:

2 Likes

That would be great!

TBH, I am not putting as much time as I would like into this at the moment because of work and family commitments, but anything that you would like to contribute would be fantastic. Hopefully I will be able to get back to this at some point in the near future.

I would put this in the Extensions Marketplace once that we get it to a point where we think it has enough features, and they are stable enough for more people to jump in. What I would not want is that we put in there something half-baked, and people run away from it ;).

Thanks a lot and hope you find it useful,
Luis

1 Like

Just tried to run Sonic Pi in Visual Studio Code 1.72.2 under Windows 10. The well used extension “Sonic Pi” from Jackson Kearl did not work with the newest version of Sonic Pi 4.3.0, probably because file names and paths changed. I got it to work with “Sonic Pi Extension” from s00500 directly installed from the Extensions Marketplace. This extension is a preview and not very stable yet. But combined with the Jupyter-Extension I was able to make a Jupyter notebook tutorial for Sonic Pi with code that can be directly played within the notebook.
The tutorial can be found in GitHub, it is in German and a work of progress.

Unfortunately the sound is not as good as in the Sonic Pi IDE, especially with longer and more complicated code blocks the sound is distorted. Does anyone have the same problem with distorted sound in Visual Studio Code?