SuperCollider VSCode / Language Server Protocol support

Actually, if I’m reading this correctly, neovim is hard-coded to communicate with the language server only via stdin/stdout. This will unfortunately take some time to hook up, since it involves routing JUST LSP related communication to stdin/stdout, and all other communication to another pipe. This seems relatively easy for the standard TerminalClient, but it seems like there are a lot of printf's that need to be removed as well :confused:

If someone has more expertise with pipe trickery, maybe there’s a more straightforward solution here? If this is a blocker for NeoVIM I can prioritize getting this working.

@scztt This is great news, thanks for developing this! :heart:

Neovim seems to only handle stdio for language server communication at the moment. (Quoting from the the nvim documentation :help lsp)

Communication with the server is currently limited to stdio.

I was thinking about creating a wrapper of sorts to begin trying this out in Neovim. It could be a standalone executable that spawns an instance of sclang and can receive JSON RPC via stdin and forwards that to sclang via a TCP socket (and then the other way around for responses). Does this sound like something that might work with the current implementation of the language server?


@madskjeldgaard Great to see that you’re working towards lsp-config integration!

It is also possible to add servers to lsp-config without forking the repo, instead you could add something like this to your Neovim config:

local lsp = require'lspconfig'
local configs = require'lspconfig.configs'

if not lsp.supercollider then
  configs.supercollider = {
    default_config = {
      cmd = {''};
      filetypes = {'supercollider'};
      root_dir = function(fname)
        return vim.fn.getcwd()
    settings = {};
    docs = {
      package_json = '';
      description = [[]];
      default_config = {
        root_dir = [[]];


Yeah I was just thinking this - actually I imagine it would be easy to whip up a Python script that would make the RPC connection and forward things to/from stain/stdout.

I may try this over the weekend, but if you want to attempt something similar let me know - happy to triage any issues that come up!

I was thinking that there may actually be good reasons to have a wrapper manage sclang from an LSP perspective, so that it could handle language reboots and recover from crashes and whatnot.

I have something here that might be worth a try GitHub - davidgranstrom/sclang-lsp-stdio: A TCP/stdio wrapper for LanguageServer.quark

But unfortunately its not working yet! :slight_smile: There seems to be an issue when trying to connect to the sclang TCP port (the server connection seems fine). I need investigate a bit more, it was also a while since I used the node.js API so I might have forgotten something simple…

1 Like

Ah very cool, I’ll can look at what might me missing from this soon? Here’s where we’re spinning up the connection in the vscode plugin - I’m not 100% sure, but I think it depends mostly on stock node API’s?

Thanks @scztt, I changed the client adapter to send UDP packets instead of TCP and it seems to work!

Neovim’s LSP client is now able to send requests to the SuperCollider language server, but I think there might a problem with parsing the JSON RPC messages on the SuperCollider side. I will continue investigating… if you want I can open a new issue and post the (SuperCollider) stack trace in the LanguageServer.quark repo?

I really appreciate this thought and work. Both @scztt and @madskjeldgaard (and many others) are always on this, which is so well beyond me at this point.

I love and have been using the sc-nvim plugin for neovim @madskjeldgaard - this was quite honestly (per other posts or comments) my actual first adventure into neovim . But catching the drift. I’ve used VS Code for various things, before that (or along with) Atom, before that Sublime Text, and on an on. If what I understand from this LSP, this would be astounding to say the least. Sadly, now I only open SCIDE for immediate grab of the setup file. What is great is the help system though as well. I haven’t taken the time at this point to delve into getting help to work in nvim, but mostly rely on browsers. Then again I’m very far behind you all.

Point is, this makes sense. IDE agnostic. You all rule!

And I want to say. The SCIDE is killer. I mean that to all who helped on that front. I’d still say as a newbie this is the best place to start.

Great to hear ! FYI @davidgranstrom is the one who has done most of the Neovim work. Without him we would be screwed :slight_smile:


@davidgranstrom Your stdio wrapper should now work out of the box with the SuperCollider Language Server - I was able to run the vscode LSP implementation against it using a completely vanilla stdio-based configuration, so hopefully that will resolve things for neovim as well. Let me know if you see any issues.


Fantastic! Can’t wait for this to land in the stable branch… Thank you so much for your work on this, @scztt


  • LanguageServer: LSPDocument now supports incremental updates, and isEdited property. This won’t matter much in a usability sense, but incremental updates should be much more performant than re-sending the entire document on each keystroke :slight_smile:
  • LanguageServer: Add a missing JSON class for JSON encoding. Note that this conflicts with an almost identical class in the relatively old API quark. The behavior should be identical, and a few minor issues have been fixed, but if you see error messages and are using API, this is why.

@davidgranstrom this should fix your JSON problems


Thanks for your wonderful work
As per instructions on vscode-supercollider, I tried building the mentioned branch, and the build fails with this error

/usr/include/sndfile.h:356:33: error: conflicting declaration ‘typedef struct sf_private_tag SNDFILE’
  356 | typedef struct sf_private_tag   SNDFILE ;

I am on linux 5.17.3. Since its an sndfile error, I tried it with both repo version of sndfile 1.1.0-2 and git version 1.1.0beta1.r11.g110e26d9-1. No success

EDIT: For anyone else facing this issue, downgrading libsndfile to 1.0.31 fixes it

Hello :slightly_smiling_face:

@davidgranstrom I see above a post indicating that it should now work with Neovim. Are you planning to add it to scnvim?

Hi all,

Just curious about the state of LSP for SC these days, specifically making it work with scnvim… has there been any recent developments?


Is this still being worked on? If you need any help I can try to contribute.


I’m super enthusiatic about this project and I’d be glad to help if I can, especially on the nvim integration.


Hey! Some more triage for NeoVim would be helpful - so far VSCode is the only client I’ve gotten working, so I’m sure there will be some bugs / client-specific pitfalls in the implementation so far.

Here’s a GitHub ticket for the first part of that work. It should provide some information about what the requirements are. Both this thread and @davidgranstrom’s script are good starting points as well.

I’m happy to triage anything that comes up - please file them as comments on that ticket or as GitHub issues since it’s a bit easier for me to track them that way. I just pushed a bunch of updates to the LanguageServer quark and the vscode client, so things should be in relatively good shape!

1 Like

Happy to take contributions, my ability to spend time on this is intermittent so of course it will all go a LOT faster with help :slight_smile:
I’ve got a backlog of things that need implementing here: SuperCollider vscode support · GitHub

The “todo” column is in priority order, so if anything near the top of the list looks interesting, I’d happily accept help on it.

Also, as a smaller but still incredibly useful task: JUST getting the vscode extension set up (see the README), filing any issues that come up, and proposing pull requests where the documentation could be improved would be a massive help.


  • LanguageServer: Fixed issues with very large JSON messages both to and from the server.
  • LanguageServer: Numerous small fixes and clean-up work


  • I now have a new code formatter working with LanguageServer.quark, based on @lnihlen’s amazing Sparkle sclang parser. This allows you to format code from sclang itself (both in the context of the language server, and for use-cases like sclang-based code views). It also resolves most or all of the longstanding buggy / incorrect formatting issues with the ScIDE formatter. I’ll push this feature soon, but it needs some general clean-up and unit tests. This one is pretty exciting, since formatting was the last large feature missing from the vscode plugin that made it not usable for me for day-to-day SuperCollider work.