sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.62k stars 914 forks source link

Possible to use with external editor? #1902

Open TomasHubelbauer opened 6 years ago

TomasHubelbauer commented 6 years ago

Hey, I have just discovered this software and love the idea! However, the entire UI of the app, I am not a fan of. What I am a fan of is VS Code. I think what would be a really nice touch is if Sonic Pi was able to listen on a file for changes so people could use an editor of their choice. Is something like that possible today?

And if not, I don't know if you are familiar with Language Server Protocol? I think it could be used to provide sort of a daemon which many IDEs could communicate with (much easier to support just LSP than to try and please everyone who uses different IDEs with different extensibility models).

I have not done this before, but if you'd be down to mentor me on the Sonic Pi's side of things, I'd like to try and implement a super basic PoC of LSP to see if I could get VS Code to talk to Sonic Pi over LSP's extension messages. Not only should it be able to support listening on file changes, but also provide code completion and even the waveform data if a VS Code plugin to display them was implemented (which wouldn't be very hard to do given that VS Code supports WebView based extensions now so we could just render waveform data to a canvas).

Please let me know what you think of the idea.

arun6202 commented 6 years ago

it's a great idea, please implement.

vlrmprjct commented 6 years ago

@TomasHubelbauer , look around this post: https://in-thread.sonic-pi.net/t/running-sonic-pi-code-from-atom-text-editor/1193 Maybe there is a way for VS Code without changing Sonic-Pi Sourcecode.

TomasHubelbauer commented 6 years ago

@telekommander Way cool, thank you, I will definitely check that out!

vlrmprjct commented 6 years ago

@TomasHubelbauer ,
Great! Please let me know if you have a working prototype or version.

DannyBen commented 6 years ago

I believe enabling external editors to work with Sonic Pi should be easy and with minimal changes to Sonic Pi.

If Sonic Pi provides these global (operating system wide) keyboard shortcuts:

  1. Play
  2. Stop
  3. Reload script from the last loaded or saved script file

Since I cannot work with the local editor due to its messy font sizes and non-intuitive choice of shortcut keys, I have developed a short AutoHotkey script that sends these commands to Sonic Pi.

In my case, since to my knowledge there is no way to tell Sonic Pi to reload saved script, I am simply sending a "Select All then Paste" keyboard input to it.

It works, but I wish Sonic Pi had these globally available keys.

A5308Y commented 5 years ago

For sublime there's https://packagecontrol.io/packages/Sonic%20Pi

RadW2020 commented 5 years ago

Anything new here?

TomasHubelbauer commented 5 years ago

FWIW I didn't end up pursuing this

kylegrover commented 4 years ago

This seems to do the trick: https://marketplace.visualstudio.com/items?itemName=mactkg.sonic-pi

bhrutledge commented 4 years ago

Related discussion going on in #2371.

ninest commented 4 years ago

Until the extension is ready, you can use sonic-pi-cli along with custom tasks and keyboard shortcuts.

Here's a gist with all the files you need to change. I've explained everything in this post.

piscespieces commented 3 years ago

Any news on this?

ethancrawford commented 3 years ago

@piscespieces - The (volunteer, besides Sam Aaron) core team have been focussed on preparing the latest beta/release of Sonic Pi - so no further development in the VS code extension as yet.

Chaitanyabsprip commented 3 years ago

any work on the language server protocol? I am using this with (neo)vim

marcofeltmann commented 2 years ago

For (n)vim there is https://github.com/lilyinstarlight/vim-sonic-pi

frederikheld commented 1 year ago

For my most basic need (use an interface for coding that I'm used to) the solution could be as simple as hot-reloading changes to files on the disk into the Sonic Pi editor. I can live with doing [Alt + R] and [Alt + S] in the Sonic Pi editor, but what breaks me every time is all the other shortcuts that throw sticks between my spokes (including the ones I can't use because I'm using a German keyboard).

https://wiki.seeedstudio.com/Use_External_Editor/

So why not do it like the Arduino IDE does it? User can enable "Use external editor", which makes the internal editor read only and hot-reloads changes from disk. Would be a huge step forward to enable alternative editors.

Background: the Arduino IDE suffers from the same approach as Sonic Pi: it is great to learn coding from scratch as a first-timer because it simplifies the interface a lot. But as soon as you reach a certain level, the reduced functionality limits your creativity. And for people who are fond of coding but used to more elaborate editors, it feels like a cage. The Arduino project did two steps to bridge the gap between professionals and beginners: first they allowed external editors, then they introduced arduino-cli, which completely de-couples the build-system from the editor. Would be great to have this for Sonic Pi as well.

Arduino references: