An Erlang server implementing Microsoft's Language Server Protocol 3.0.
This project is still under heavy development and it is therefore not still suitable as a fully-functional language server for daily usage. Said that, contributors and early users are extremely welcome.
If you have any issues or questions about the project, feel free to open a new issue. You can also join the #language-server channel in the Erlanger Slack if you would like to get involved or if you prefer a more informal mean of communication.
- Erlang OTP 21+
- rebar3 3.9.1+
Compile the project:
lsp-mode package already includea a client for the
Erlang Language Server, so simply add the following to your
file (assuming the
erlang_ls executable is available in your
;; Install the yasnippet dependency (package-install 'yasnippet) ;; Install the official lsp-mode package (package-install 'lsp-mode) ;; Enable LSP automatically for Erlang files (add-hook 'erlang-mode-hook #'lsp)
Ensure you have Erlang (i.e.
escript and friends) as part
of your Emacs path. If you don't, you can try the following:
;; Ensure your Emacs environment looks like your user's shell one (package-require 'exec-path-from-shell) (exec-path-from-shell-initialize)
To enable logging on the client-side, just:
(setq lsp-log-io t)
This section summarizes the functionalities currently implemented by
Code navigation is currently available for the following elements:
- Function applications (both local and remote)
- Behaviour attributes
- Included files
- Type definitions
- Record definitions
- Macro definitions
- Export list entries
- Import list entries
Code Completion (incomplete)
Completion requests are sent from the client to the server to compute completion items at a given cursor position. Completion items are presented to the user for easy selection.
Code completion are typically triggered by one of the following
: # . ?.
Code completion is available for the following elements:
- Erlang keywords (e.g.
- Variables in the current scope
- Local function names
- Built-in functions (e.g.
- Module names
- Record names
- Record fields
- Atom names
- Module attributes
It is possible to customize the behaviour of the
erlang_ls server by
erlang_ls.config file to the root of your projects.
erlang_ls.config file would look like the following:
otp_path: "/path/to/otp/lib/erlang" deps_dirs: - "lib/*"
Currently, the following customizations are possible:
|otp_path||Path to the OTP installation|
|deps_dirs||List of directories containing dependencies. It supports wildcards.|
It is possible to compile and start the language server in debug mode:
rebar3 as debug escriptize
Ensure you update your
PATH to include the new executable which now
Once an instance of the server is running you can connect to it via:
erl -sname debug -remsh erlang_ls@`HOSTNAME`
The redbug application is included in debug mode, so feel free to use it.
erlang_ls project is licensed under the Apache License 2.0. Please refer to the
LICENSE file for details.