This is a simple package to make using Julia’s language server easier
with eglot. It can be installed from melpa by adding melpa to your
package-archives
and doing M-x package-install RET eglot-jl RET
with Emacs 26.1+.
After installation, eglot-jl-init
will load support for the Julia
language server into eglot and project.el. If eglot-jl-init
has been
run in your emacs session, running eglot
in a julia-mode
buffer
will start a language server for the Julia project to which the buffer
belongs. The first time eglot
is run, the Julia language server will
be downloaded and installed into the default depot (e.g. ~/.julia
)
in its own isolated project environment. This may take a long time, so
eglot-connect-timeout
should be increased for this first run.
Completion:
Show help and signatures in the minibuffer:
Show docstring for symbol at point (eglot-help-at-point
):
Jump to definitions of symbol at point (xref-find-definitions
):
Rename symbol at point (eglot-rename
):
Linting:
Jump to symbol in document imenu
:
The most likely reason is that SymbolServer.jl takes a very long time
to process project dependencies. This is a one-time process that
shouldn’t cause issues once the dependencies are cached, however it
can take over a minute to process each dependency. By default, eglot
will only wait wait 30 seconds for a language server to be ready; this
is controlled by eglot-connect-timeout
.
To work around this issue, you can:
- Set
eglot-connect-timeout
to a very high value.- Progress of the SymbolServer can be monitored in the
*EGLOT (ProjectName/julia-mode) stderr*
buffer.
- Progress of the SymbolServer can be monitored in the
- Run the following, from your project directory:
julia --project=path/to/eglot-jl/ path/to/eglot-jl/eglot-jl.jl
The SymbolServer is finished with caching dependencies when it displays:
[ Info: Received new data from Julia Symbol Server.
No, you can manually update the self-contained julia environment that eglot-jl is configured to create by default. Using the REPL, as an example:
julia> using Pkg
julia> cd("/home/username/.emacs.d/elpa/eglot-jl-20211208.359/") # where your version of eglot-jl is
julia> Pkg.activate(".")
julia> Pkg.update()
This will update the dependencies of the server to latest compatible version. Note that LanguageServer.jl itself won’t be automatically updated if its major version has increased, as major versions are explicitly specified in the [compat] section of Project.toml. Depending on what breaking changes a new major version of LanguageServer.jl includes, altering the code in eglot-jl may be necessary before we can safely add a new major version as being compatible in our Project.toml.