VS Code integration?

The only thing missing in Sprites right now is a simple way to open a VS Code instance connected to it. I imagine running code . inside a Sprite machine within a directory—just like I do on my local terminal—and having it open a VS Code instance on my local machine with everything set up similar to the GitHub Codespaces experience, but much faster.

Are there any plans for this feature?

3 Likes

maybe code-server is what you need ? GitHub - coder/code-server: VS Code in the browser

code-server runs a web-based VS Code instance and yes, it works, but it’s not my local VS Code instance. It’s close, but not quite.

If Sprites are able to forward ports to the host machine, I’d think it should be pretty simple to have it working with the VS Code Remote SSH extension (or maybe a custom one developed by the Sprites team).
I mean, it comes with all languages, frameworks and agents CLIs. It’s only missing being able to connect to a Sprite from VS Code.

2 Likes

Ok, I got it working! code-server is not official by Microsoft, it’s based on the open source version of VS Code which comes with limitations.

On the other hand, Microsoft offer its own “Code Server” and Tunnels.

All that’s needed is to run the curl + tar commands and then

curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz

tar -xf vscode_cli.tar.gz

./code tunnel

And then you can connect remotely from your local VS Code instance.

So my suggestion would be to already provide the code CLI via a shim as you already do with the other CLI tools so simply creating a new sprite and then doing `code tunnel` would allow for quickly connecting to it from the host’s VS Code.

I claimed victory a bit too early…

While I can connect to the sprite via VS Code tunnel and work like a regular local environment. Launching any web server from it doesn’t work.

Launching the vite dev server at localhost:5173 doesn’t work - it forwards to a *.use.devtunnels.ms but throws HTTP 502 error.

I assume sprite and code tunnel are conflicting for this port forwarding.

Anyway, I assume this is something that could be fixed by the sprites team.

+1, this would be really great!

The tunnel command requires GitHub/Microsoft authentication and routes all your traffic through Azure. If you want to skip that, you can run ./code serve-web on the Sprite, then run sprite proxy 8000 on your local machine.

The serve-web command will give you a URL like http://127.0.0.1:8000?tkn=<uuid> where you can access a VS code interface.