Eglot layer
Table of ContentsClose
1. Description
This layer adds support for basic language server protocol packages speaking language server protocol using eglot.
1.1. Features:
- Provide LSP support using eglot.
- Provide Flycheck integration using flycheck-eglot
2. In Development!
There is not much going on with this layer right now, it only has the most basic of setup. Hopefully each language layer will start adopting it and completing the integration.
3. Key bindings
A number of eglot features have been bound to the eglot--managed-mode minor mode,
meaning they are available in all language layers using the eglot layer under
the major mode leader key SPC m / ,:
These key bindings are selected to match with the +tools/lsp layer regarding similar functions.
3.1. Format
| Key binding | Description |
|---|---|
SPC m = b |
Format buffer |
SPC m = r |
Format region |
SPC m = o |
Organize imports |
3.2. Code actions
| Key binding | Description |
|---|---|
SPC m a a |
Code actions |
SPC m a f |
Quickfix |
SPC m a i |
Inline |
SPC m a e |
Extract |
SPC m a o |
Organize imports |
3.3. Goto
| Key binding | Description |
|---|---|
SPC m g d |
Find definitions |
SPC m g D |
Find definitions other window |
SPC m g r |
Find references |
SPC m g i |
Find implementation |
SPC m g t |
Find type definition |
SPC m g C |
Find declaration |
SPC m g b |
Go back |
3.4. Backend
| Key binding | Description |
|---|---|
SPC m b r |
Reconnect |
SPC m b s |
Shutdown |
SPC m b e |
Events buffer |
SPC m b S |
Shutdown all |
3.5. Refactor
| Key binding | Description |
|---|---|
SPC m r r |
Rename |
SPC m r i |
Inline |
SPC m r e |
Extract |
SPC m r o |
Organize imports |
SPC m r f |
Format |
3.6. Toggles
| Key binding | Description |
|---|---|
SPC m T h |
Toggle inlay hints |
4. Language layer integration
Here is an example on how to integrate eglot into the language backend of a layer:
(defun spacemacs//ruby-setup-backend ()
"Conditionally configure Ruby backend"
(spacemacs//ruby-setup-version-manager)
(pcase ruby-backend
('eglot (spacemacs//ruby-setup-eglot))
('lsp (spacemacs//ruby-setup-lsp))
(nil (ignore))
(_ (spacemacs-buffer/error "Ruby Layer - unknown language backend: %s" ruby-backend))))
(defun spacemacs//ruby-setup-eglot ()
"Setup Ruby eglot."
(if (configuration-layer/layer-used-p 'eglot)
(eglot-ensure)
(message "`eglot' layer is not installed, please add `eglot' layer to your dotfile.")))