VSCode-supercollider Current State MacOS

I just pushed a fix for this as well, should be available if you update LanguageServer.quark.

2 Likes

in works indeed thanks for those fixes!

This is so good. Thank you. I thought the workspace vibe might be annoying, but it is amazing. Having the whole file system on the left column clarifies so much for larger projects. Everything is right there. Being able to close the help window: amazing! The Evaluate Block feature is incredible and will be a huge boon, especially for beginners.

One issue: after running thisProcess.recompile, nothing works. It looks like it is ready to go, but it isn’t. I have to close the workspace and open it back up again. Any idea?

Sam

I see. I need to restart sc lang. That works!

Sam

FWIW: It was always possible in SC-IDE to undock and close the help browser.

hjh

Thank you for this!

I am having some problems installing the updated LangaugerServer quark as follows:

  • generally:
    It would be nice if vscode would show a message that the LangaugerServer installation is complete…

  • on MacOS
    vscode and vscodium install the old version by running “SuperCollider: Update LanguageServer.quark” from within vscode, so the location of LSPDocument.sc is still in the LanguageServer folder and the scide_vscode folder does not exist;

  • on Windows 11 Pro
    I get an error (I have not installed vscodium on Windows):

    command ‘supercollider.updateLanguageServer’ not found

    every time I do the following

  • on Ubuntu:

    1. When running “SuperCollider: Update LanguageServer.quark”, vscode cannot find sclang in the default path, even though it is there. I have manually selected sclang in `/usr/bin’ after pressing the ‘Find sclang’ button:

    2. I was then able to successfully install Quark.

    3. When I opened an scd file, sclang started, but I got the following error:

       Found 862 primitives.
       Compiling directory '/usr/share/SuperCollider/SCClassLibrary'
       Compiling directory '/usr/share/SuperCollider/Extensions'
       Compiling directory '/home/parallels/.local/share/SuperCollider/Extensions'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Notator'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Strang'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/sc3-dot'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Singleton'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Collapse'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/WindowViewRecall'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Log'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/UnitTest2'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/Deferred'
       Compiling directory '/home/parallels/.local/share/SuperCollider/downloaded-quarks/LanguageServer'
       numentries = 877960 / 13601616 = 0.065
       5783 method selectors, 2352 classes
       method table size 14470056 bytes, big table size 108812928
       Number of Symbols 13624
       Byte Code Size 429747
       compiled 385 files in 0.78 seconds
      
      Info: 4 methods are currently overwritten by extensions. To see which, execute:
      MethodOverride.printAll
      
      compile done
      localhost : setting clientID to 0.
      internal : setting clientID to 0.
      Couldn't set realtime scheduling priority 1: Operation not permitted
      Class tree inited in 0.01 seconds
      ERROR: Message 'addRawRecvFunc' not understood.
      RECEIVER:
      Instance of Main {    (0xaaaadaef4398, gc=68, fmt=00, flg=00, set=04)
        instance variables [11]
          classVars : instance of Array (0xaaaada6dec00, size=513, set=10)
          interpreter : instance of Interpreter (0xaaaadaef4768, size=30, set=5)
          curThread : instance of Thread (0xaaaadaef44c8, size=27, set=5)
          mainThread : instance of Thread (0xaaaadaef44c8, size=27, set=5)
          schedulerQueue : instance of Array (0xaaaadaf1c240, size=1, set=12)
          nowExecutingPath : nil
          platform : instance of LinuxPlatform (0xaaaadaef4ba8, size=5, set=3)
          argv : nil
          recvOSCfunc : nil
          prRecvOSCFunc : nil
          openPorts : instance of Set (0xaaaadb0dbe58, size=2, set=2)
      }
      ARGS:
      Instance of Function {    (0xaaaadc9475e8, gc=64, fmt=00, flg=00, set=02)
        instance variables [2]
          def : instance of FunctionDef in Method LSPConnection:start
          context : Frame (0xaaaadb1d8a28) of LSPConnection:start
      }
      CALL STACK:
          DoesNotUnderstandError:reportError
              arg this = <instance of DoesNotUnderstandError>
          Nil:handleError
              arg this = nil
              arg error = <instance of DoesNotUnderstandError>
          Thread:handleError
              arg this = <instance of Thread>
              arg error = <instance of DoesNotUnderstandError>
          Object:throw
              arg this = <instance of DoesNotUnderstandError>
          Object:doesNotUnderstand
              arg this = <instance of Main>
              arg selector = 'addRawRecvFunc'
              arg args = [*1]
          LSPConnection:start
              arg this = <instance of LSPConnection>
          < FunctionDef in Method Meta_LSPConnection:initClass >  (no arguments or variables)
          Function:doOnStartUp
              arg this = <instance of Function>
          ArrayedCollection:do
              arg this = [*6]
              arg function = <instance of Function>
              var i = 5
          List:do
              arg this = <instance of List>
              arg function = <instance of Function>
          Meta_StartUp:run
              arg this = <instance of Meta_StartUp>
          Main:startup
              arg this = <instance of Main>
              var didWarnOverwrite = false
      ^^ The preceding error dump is for ERROR: Message 'addRawRecvFunc' not understood.
      RECEIVER: a Main
            
      
      Couldn't set realtime scheduling priority 1: Operation not permitted
      

This one, at least, has been discussed earlier. You need to build from the head of the develop branch. A version-tag release is currently not supported for the VSCode plugin.

That probably also affects this: “vscode cannot find sclang in the default path” – if you built from source, then it’s /usr/local/bin/sclang – I didn’t have the “cannot find sclang” problem on my machine.

hjh

1 Like

Ah yes, I didn’t really think of this - but since SuperCollider itself is providing the language server, recompiling from the sclang side looks to VSCode as it the language server simply disappeared. This can be fixed in the long term, but I think for now restarting from VSCode is the proper way to do this.

Ah! Yes, the version of SC on my ubuntu is 3.11.2. I should update it! Thanks!

tip: update to the nightlies, not 3.13 as it is not recent enough.

1 Like

Thx :slight_smile:

Yeah workspaces have been so beneficial for me. I can get an easy git history for things I’m working on, throw a markdown file in with some TODO items. And, it has turned out to be really nice that I can open another workspace and it launches a completely separate instance of SuperCollider so I don’t disrupt what I’m current working on.

There’s a nice VSCode extension that adds auto-hide behavior to the project panel too - I use this sometimes when I’m in more of a performance workflow and want the screen real-estate.

On that topic, the VSCode Bookmarks extension is incredible for slightly larger SC projects. I can add bookmarks to different lines of code where I have e.g. synths defined, or blocks that i need to run often, and jump between them in a few different ways.

This is good to know. Should our default linux behavior be to FIRST default to /usr/bin/sclang and then /usr/local/bin/sclang if the first doesn’t exist?

thanks for sharing! this opens a new stage of supercolliding for me

I found another thing here. If I recompile the class library and (gasp!) I have made an error in my class library code, the IDE is in a state where I can’t do anything. I can’t recompile again or restart the language or anything. VS Code is working fine, but the connection to SCLang is gone. The only way out I have found to regain a connection is to close the workspace and open it back up. Does anyone have a better way to recompile after a failed library compile?

Sam

Tbh I’m not sure which is better. I think, if I went to the trouble of building from source, I’d like the locally-built executable to be preferred, but there may be a POSIX recommendation or policy on that and I don’t know if that disagrees.

hjh

Considering the perspective of a beginner, it is reasonable to assume they would opt for installing software via a package manager rather than compiling from source. In this case, the path would be typically /usr/bin .

If you went to all the trouble of compiling the program, you may be able to modify the text editor settings, right?

1 Like

The other LSP implementations I use run their servers as separate processes. But I believe sclang could be unique, potentially requiring its LSP to run in the same process as the interpreter because the way we use the language in the first place? Is it due to its Document class re-implementation? Maybe that’s the way it needs to be. Or a separate sclang process (not running all lsp feature, just some) would give more stability?

Take Haskell Language Server (HLS) as a example— although it must be compiled with the same GHC’s version, it still runs as a independent process. You can restart the LSP and it won’t interfere with a repl (ghci) session, and vice versa.

I would expect the behavior of searching PATH as if by command -v or which. IMO that is kind of why this variable exists :slight_smile: FWIW on Ubuntu your default PATH has /usr/local/bin before usr/bin.

It should work to use the “Restart sclang” command. If sclang is totally non-responsive (e.g. in case of a compile error), you might have to do it twice, there seems to be a timeout condition that needs to be hit before it will properly restart. I’ll be improving this more in the future - unfortunately, the documentation in VSCode for the lifetime of a language server is not so clear, so I’ve been having to reverse-engineer what it means to “restart” a language server from scratch.

This is probably correct. I don’t know the details of how node.js handles subprocess execution - I wonder, if it is ONLY given an executable name (e.g. sclang), it uses the usual shell functionality to search PATH to find the binary? This would be ideal.