Skip to content

ffevotte/eglot-jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eglot-jl

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.

Capabilities

Completion:

./images/completion.gif

Show help and signatures in the minibuffer:

./images/minibuffer_help.gif

Show docstring for symbol at point (eglot-help-at-point):

./images/eglot-help-at-point.gif

Jump to definitions of symbol at point (xref-find-definitions):

./images/xref-find-definitions.gif

Rename symbol at point (eglot-rename):

./images/eglot-rename.gif

Linting:

./images/lint.gif

Jump to symbol in document imenu:

./images/imenu.gif

FAQ

Why am I receiving Error running timer: (error "[eglot] Timed out") messages?

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:

  1. Set eglot-connect-timeout to a very high value.
    • Progress of the SymbolServer can be monitored in the *EGLOT (ProjectName/julia-mode) stderr* buffer.
  2. 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.

Can I speed-up server start-up times?

By default, starting a new language server (which is done once per project) takes some time: around 20 seconds are needed before the server is ready, which manifests itself by the [eglot:projectName] indicator showing up in the modeline.

A custom system image, created using =PackageCompiler.jl=, can be used to reduce this latency. The whole process of creating and using a system image can be automated by setting the eglot-jl-enable-sysimage customization option in Emacs:

(setq eglot-jl-enable-sysimage t)

When this setting is activated, you’ll be prompted to start building a system image the first time eglot-jl is initialized. You’ll also be prompted to re-build the sysimage each time this is necessary: when the Julia version changes, or when eglot-jl itself gets updated.

It will take a few minutes to generate a system image, which eglot-jl will detect and automatically use for subsequent language server runs. This should reduce language server startup times to 1 or 2 seconds.

If anything goes wrong with system images, you can deactivate this feature altogether by restoring eglot-jl-enable-sysimage back to its default value.

About

Wrapper for using Julia LanguageServer.jl with emacs eglot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 65.6%
  • Julia 34.4%