Stream: beginners

Topic: vscode server on wsl2 with language server


view this post on Zulip Robin (Mar 30 2025 at 13:11):

New to roc, just setting it up in a WSL image no my windows box.
Vscode works fine with the remote server behavior and the extension seems fine. The language server does not work seeing the errors below in the log.
Is this expected at the moment?
I can understand roc being new and maybe the extension for vscode can't do the remote dance yet.

You are ready to Roc![Error - 11:07:17 PM] Client roc-lang: connection to server is erroring.
write EPIPE
Shutting down server.

view this post on Zulip Anton (Mar 31 2025 at 08:42):

Hi Robin,
In the settings of the roc-lang-unofficial extension you need to provide the path to the roc language server binary (included in the alpha or nightly archive) or did you already do that?

view this post on Zulip Robin (Mar 31 2025 at 08:53):

Yes followed the instructions.
NOTE: I am running vscode on my windows desktop and it connects to vscdoe server in the WSL. I thought this might complicate it.
Though it has worked for most any other addons ive used over the years.

view this post on Zulip Anton (Mar 31 2025 at 08:56):

:+1: I'll try to reproduce this on my pc and investigate (probably today)

view this post on Zulip Robin (Mar 31 2025 at 08:58):

I'm not sure how much you know about wsl2.
but just running "code" in wsl shell will setup the vscode server for you in the wsl linux and start vscode on desktop and it connects automatically.

view this post on Zulip Anton (Mar 31 2025 at 09:04):

I didn't know that, I'll try it like that

view this post on Zulip Artur Domurad (Mar 31 2025 at 13:16):

I used Roc this way for couple of months.
VSCode on windows and the Roc code was on WSL2 Ubuntu.
Everything worked OK.
My roc language server was on WSL - not on windows. That might be worth checking.

view this post on Zulip Robin (Mar 31 2025 at 13:36):

my roc servers is inside the wsl image.

view this post on Zulip Robin (Mar 31 2025 at 13:37):

I run debian, but there are no other errors.
But I will try ubuntu tomorrow to see.

view this post on Zulip Anton (Mar 31 2025 at 13:56):

Can you share your debian version? That way I can use it for the reproduction

view this post on Zulip Robin (Mar 31 2025 at 14:09):

I've just retried in Ubuntu-22.04
Did an apt update && apt upgrade.
Installe roc into /home/rluiten/.local/bin/roc_nightly-linux_x86_64-2025-03-22-c47a8e9
Added that to path in .bashrc.
so roc version works.
Lauched vscode with 'code .' in a folder with trivial main.roc in it.
The installed "Roc (Unofficial)".
Set the Roc-lang > Languae-server: Exe fild in exension to
/home/rluiten/.local/bin/roc_nightly-linux_x86_64-2025-03-22-c47a8e9

Getting same error as follows. (not set path of roc lsp)

LS executable path: Some(/home/rluiten/.local/bin/roc_nightly-linux_x86_64-2025-03-22-c47a8e9)
LS debug executable path: None
You are ready to Roc![Error - 12:06:12 AM] Client roc-lang: connection to server is erroring.
write EPIPE
Shutting down server.

view this post on Zulip Robin (Mar 31 2025 at 14:10):

turns out i didnt go to bed when i should have lol :)

view this post on Zulip Robin (Mar 31 2025 at 14:10):

That is the alpha3 rolling version.

view this post on Zulip Robin (Mar 31 2025 at 14:11):

I even remembered to check my firewall logs just in case.
Never had it triggered by WSL stuff before, but its clean, but I also have it off anyway no difference.

My Ubuntu image is in WSL v2 mode - just realised may not have stated that before.

view this post on Zulip Anton (Mar 31 2025 at 14:26):

Thanks for all the details, I'll try in a bit

view this post on Zulip Robin (Mar 31 2025 at 14:33):

Given Artur's comment above. I am very surprised it doesn't just work.

view this post on Zulip Robin (Mar 31 2025 at 14:33):

I'm off to bed starting to brain fade :)

view this post on Zulip Anton (Mar 31 2025 at 15:07):

Set the Roc-lang > Languae-server: Exe file in exension to
/home/rluiten/.local/bin/roc_nightly-linux_x86_64-2025-03-22-c47a8e9

This needs to be the path to the binary, not the folder that contains the binary, so: /home/rluiten/.local/bin/roc_nightly-linux_x86_64-2025-03-22-c47a8e/roc_language_server

view this post on Zulip Artur Domurad (Mar 31 2025 at 15:15):

I have just tried with a clean WSL2 Ubuntu on clean Windows installation without vscode, etc.
I had the same problem for a moment.
When I was doing

code .

My vscode was launching not connected to WSL. I could see my wsl files, but vscode could not launch wsl programs.
The roc lang server started working for me only after I have installed the WSL extension in vscode and restarted wsl. Just clicked in the bottom left corner and selected "connect to WSL" and it installed automatically. Then close vscode and open it from WSL again.
Make sure you have something like this in the bottom left corner:
image.png

view this post on Zulip Anton (Mar 31 2025 at 15:22):

Yes, confirmed, that works, thanks @Artur Domurad :)

view this post on Zulip Robin (Mar 31 2025 at 23:48):

Thank you that works.
Oh duh... how did i miss that... sorry for my goof

view this post on Zulip Robin (Apr 01 2025 at 04:13):

Just had a thought since the document says to add the folder to path for command line usage, is there a reason the plugin cant' assume its on path and just run someting like a roc_language_server version command.
NOTE: assuming it has a version thing or equivalent.

view this post on Zulip Robin (Apr 01 2025 at 04:13):

self configuring then?

view this post on Zulip Anton (Apr 02 2025 at 08:36):

There is an issue for this


Last updated: Jul 06 2025 at 12:14 UTC