Using LanguageServer.jl with eglot in emacs

This weekend I got LanguageServer.jl working with eglot (an alternative to lsp-mode), and I documented the process in the LanguageServer.jl wiki. I haven’t had enough time to play with it and see how it compares to lsp-mode, but it seems to be working pretty well; in general my impression of it so far is positive compared to lsp-mode, but I don’t know if that’s because my lsp-julia package is screwing something up, because LanguageServer.jl has improved in the several months since I last used lsp-julia, or because eglot actually works better. Let me know if you have trouble getting things working.


Thanks for the wiki writeup, it should be very useful! AFAICT LanguageServer has improved a lot recently.

I could not make this work: I see Julia using a lot of CPU for a while, then eglot timeouts. Even increasing eglot-connect-timeout to 600 didn’t help.

I am curious how I could debug this, and whether it is just normal “time to first X”, or something else. eglot-events-buffer reports

jsonrpc-error: "No current JSON-RPC connection", (jsonrpc-error-code . 32603), (jsonrpc-error-message . "No current JSON-RPC connection")

I’d recommend running something like

using LanguageServer, SymbolServer
server = LanguageServerInstance(stdin, stdout, true, "/home/you/.julia/environments/v1.1", "", Dict())

in a normal REPL and wait for a message like “Symbol store set” or similar. The first run will take a long time since it needs to load (and inspect) all packages in your environment.

1 Like

Perfect, this solved the issue.

@non-Jedi: would you consider packaging the code you wrote up in the wiki, say, as eglot-julia on MELPA?

To be honest, I don’t see a whole lot of utility in eglot+julia until
the crashing on save

is fixed. In any case, the right™ way of packaging this is probably to
push all of the project.el integration code into

and then add integrated support to the eglot package for Julia’s
language server.

I don’t have time/inclination to do either of those things at this
moment in time, but if you do (or want to package it separately), I
hereby release any code I’ve written in the LanguageServer.jl wiki