Closed SFurnace closed 2 years ago
Doesn't work for me. My solution:
create a bash script xvfb-racket
:
#!/bin/bash
for i in $*;
do
params=" $params $i"
done
xvfb-run racket $params
add to $PATH
change the Racket Path config to xvfb-racket
.
Doesn't work for me. My solution:
create a bash script
xvfb-racket
:#!/bin/bash for i in $*; do params=" $params $i" done xvfb-run racket $params
add to $PATH
change the Racket Path config to
xvfb-racket
.
Maybe "$@"
is a better way?
Just as @SFurnace suggested, I got this working using:
#!/bin/bash
xvfb-run racket "$@"
I'm using VS Code with the Magic Racket extension in Windows 10, talking to racket-langserver in a VirtualBox VM running Linux Mint.
Hey guys, is there anything I can do to make this simpler for you? Assuming no, closing issue, will re-open if need be. I will also link to this issue from the readme so that others can follow your instructions to get it working.
In the v0.6.0 it is possible to configure the command and the args that are used to launch the langserver. It should be possible to set the command to xvfb-run
and the args to racket, [...and the args that are there by default]
.
Confirming xvfb-run
+ racket
--lib
racket-langserver
works on Windows WSL on v0.6.1.
Another note--if multiple VSCode windows are opened, I found the --auto-servernum
/ -a
argument to xvfb-run
was required to avoid xvfb failing due to the default server number already being in use.
Doesn't work for me. My solution: create a bash script
xvfb-racket
:#!/bin/bash for i in $*; do params=" $params $i" done xvfb-run racket $params
add to $PATH change the Racket Path config to
xvfb-racket
.Maybe
"$@"
is a better way?
@Eugleo It would be nice if this file were included in either the magic-racket distribution as an in-built fallback. If the server fails to initialize then the bash sugar could be executed. I tried to use magic-racket today using https://github.com/gitpod-io/openvscode-server on a headless server and found myself having to tweak all kinds of things until I found this issue.
Just to put this all together since I was setting this up from a fresh WSL2 Ubuntu install, I needed to take the following steps.
Dependencies:
$ sudo apt install -y --no-install-recommends \
racket \
libjpeg62-dev \
libgtk2.0-dev \
xvfb
$ raco pkg install racket-langserver
Script wrapper:
$ cat << EOF > xvfb-racket
#!/usr/bin/env bash
xvfb-run --auto-servernum racket "$@"
EOF
$ chmod +x xvfb-racket
Then I needed to point my configuration at it:
{
"magicRacket.languageServer.command": "/home/$USERNAME/xvfb-racket",
"magicRacket.general.racketPath": "/home/$USERNAME/xvfb-racket"
}
This made the extension work on files saved to disk, but not anonymous files in the editor.
I tried to follow all of the comments here, using WSL 2 + Ubuntu 22.04.
It doesn't work for me.
In VSCode I get:
[Info - 4:37:16 PM] Connection to server got closed. Server will restart.
[Info - 4:37:17 PM] Connection to server got closed. Server will restart.
[Info - 4:37:17 PM] Connection to server got closed. Server will restart.
[Info - 4:37:17 PM] Connection to server got closed. Server will restart.
[Error - 4:37:17 PM] Connection to server got closed. Server will not be restarted.
If I try to execute highlight in REPL I get:
➜ /home/aquazi/xvfb-racket --repl --eval '(enter! (file "/home/aquazi/bench/racket-experiments/foo.rkt"))'
racket: bad module path: '(file "") derived from command-line argument:
➜ racket-experiments "hello world"
hello world: command not found
This worked for me on WSL2 + Ubuntu 22.04
Dependencies:
$ sudo apt install -y --no-install-recommends \
racket \
libjpeg62-dev \
libgtk2.0-dev \
xvfb
$ raco pkg install racket-langserver
VSCode configuration:
}
"magicRacket.languageServer.command": "xvfb-run",
"magicRacket.languageServer.arguments": [
"--auto-servernum",
"racket",
"--lib",
"racket-langserver"
],
}
Environment
Error message
I use
xvfb-run racket
in a devcontainer, but racket-langserver doesn't work. I only get error message like that:Workaround
I tried many times, and finally found if I change the
serverOptions
in extension.js fromto
then racket-langserver can work correctly. I guess vscode can communicate with the
xvfb-run racket
process by stdin/out, only when wrapping in a shell.By the way, I put my devcontainer.json at here.