theia-ide / racket-language-server

Racket Language Server
45 stars 8 forks source link

language server cannot run without a running X11 server #19

Open ghost opened 4 years ago

ghost commented 4 years ago

On linux, due to the (recursive) dependencies on gui-lib, racket-langserver cannot run without a running X11 server. I believe the responsible dependencies are, besides gui-lib itself, drracket-tools-lib, which can be easily refactored into a headless component for racket-langserver, based on my experimentation... and racket-doc, which cannot. Since I've never used racket I'm not entirely sure what that racket-doc is doing; maybe it's not so hard to fix that issue as well.

Anyways, here's what happens if you try without X installed:

Welcome to Racket v7.8.
> (require racket-langserver)
; ffi-lib: couldn't open "libgdk-x11-2.0.so.0" (libgdk-x11-2.0.so.0: cannot
;   open shared object file: No such file or directory) [,bt for context]

With X installed but not running:

Welcome to Racket v7.8.
> (require racket-langserver)
Unable to init server: Could not connect: Connection refused
; Gtk initialization failed for display ":0" [,bt for context]

For completeness, with GTK installed and a non-X backend running there's also an error loading libX11.

Since this info was surprising to some people: Yes, there's a point to running a language server on a headless server: not only for TUI text editors, but even for GUI ones like VS Code Remote. And for what it's worth, I've not run into any other language servers which require X.

DKXXXL commented 4 years ago

Any help will be welcomed. As the OP said, I am currently using Magic Racket plugin on VSCode which depends on this LSP. Since I am working on WSL2, my experience for Linux is quite limited, (I don't even know how to start X server on WSL2 to let this LSP run).

Danl2620 commented 4 years ago

The package you are referring to is hosted at https://github.com/jeapostrophe/racket-langserver. This is racket-language-server, a different implementation of the LSP.

(The Magic Racket VS Code extension uses the other LSP package.)