Using languageserver jl with eglot in emacs

If you are using the languageserver-jl package with eglot in Emacs to work with Julia, you may encounter some issues or limitations. In this article, we will explore three different solutions to address these problems and enhance your Julia development experience.

Solution 1: Updating the languageserver-jl package

The first solution is to update the languageserver-jl package to the latest version. This package provides the language server protocol (LSP) support for Julia, enabling features like code completion, documentation lookup, and linting. By updating the package, you can benefit from bug fixes, performance improvements, and new features.


# Update the languageserver-jl package
] update LanguageServer

To update the package, open the Julia REPL by typing julia in your terminal. Then, enter the package manager mode by typing ]. Finally, use the update command followed by the package name LanguageServer. This will fetch and install the latest version of the package.

Solution 2: Configuring eglot for Julia

The second solution involves configuring eglot to work seamlessly with Julia. Eglot is a client for the LSP that provides integration with Emacs. By configuring eglot properly, you can take full advantage of the features offered by the languageserver-jl package.


;; Configure eglot for Julia
(add-to-list 'eglot-server-programs '(julia-mode . ("julia" "--project=/path/to/your/project" "/path/to/julia-language-server")))
(add-hook 'julia-mode-hook 'eglot-ensure)

To configure eglot, open your Emacs configuration file (usually .emacs or init.el) and add the above code snippet. Make sure to replace /path/to/your/project with the actual path to your Julia project and /path/to/julia-language-server with the path to the Julia language server executable.

Solution 3: Trying out LanguageServer.jl

The third solution is to try out LanguageServer.jl, an alternative language server implementation for Julia. LanguageServer.jl aims to provide a more lightweight and efficient solution compared to languageserver-jl. It offers similar features and can be used with eglot in Emacs.


# Install LanguageServer.jl
] add LanguageServer

To try out LanguageServer.jl, open the Julia REPL and enter the package manager mode. Then, use the add command followed by the package name LanguageServer. This will install the package and its dependencies.

After installing LanguageServer.jl, you can follow the same configuration steps mentioned in Solution 2 to set up eglot for Julia.

Out of the three options, the best solution depends on your specific requirements and preferences. If you are already using languageserver-jl and it meets your needs, updating the package to the latest version is a good choice. If you are experiencing issues or looking for a more lightweight solution, trying out LanguageServer.jl might be worth considering. Ultimately, it is recommended to experiment with different options and choose the one that works best for your workflow.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents