File: eglot.el.html
Eglot ("Emacs Polyglot") is an Emacs LSP client that stays out of your way.
Typing M-x eglot in some source file is often enough to get you started, if the language server you're looking to use is installed in your system. Please refer to the manual, available from https://joaotavora.github.io/eglot/ or from M-x info for more usage instructions.
If you wish to contribute changes to Eglot, please do read the user manual first. Additionally, take the following in consideration:
* Eglot's main job is to hook up the information that language
servers offer via LSP to Emacs's UI facilities: Xref for
definition-chasing, Flymake for diagnostics, Eldoc for at-point
documentation, etc. Eglot's job is generally *not* to provide
such a UI itself, though a small number of simple
counter-examples do exist, e.g. in the eglot-rename command or
the eglot-inlay-hints-mode(var)/eglot-inlay-hints-mode(fun) minor mode. When a new UI is
evidently needed, consider adding a new package to Emacs, or
extending an existing one.
* Eglot was designed to function with just the UI facilities found
in the latest Emacs core, as long as those facilities are also
available as GNU ELPA :core packages. Historically, a number of
:core packages were added or reworked in Emacs to make this
possible. This principle should be upheld when adding new LSP
features or tweaking existing ones. Design any new facilities in
a way that they could work in the absence of LSP or using some
different protocol, then make sure Eglot can link up LSP
information to it.
* There are few Eglot configuration variables. This principle
should also be upheld. If Eglot had these variables, it could be
duplicating configuration found elsewhere, bloating itself up,
and making it generally hard to integrate with the ever growing
set of LSP features and Emacs packages. For instance, this is
why one finds a single variable
eglot-ignored-server-capabilities instead of a number of
capability-specific flags, or why customizing the display of
LSP-provided documentation is done via ElDoc's variables, not
Eglot's.
* Linking up LSP information to other libraries is generally done
in the eglot--managed-mode(var)/eglot--managed-mode(fun) minor mode function, by
buffer-locally setting the other library's variables to
Eglot-specific versions. When deciding what to set the variable
to, the general idea is to choose a good default for beginners
that doesn't clash with Emacs's defaults. The settings are only
in place during Eglot's LSP-enriched tenure over a project. Even
so, some of those decisions will invariably aggravate a minority
of Emacs power users, but these users can use eglot-stay-out-of
and eglot-managed-mode-hook to adjust things to their
preferences.
* On occasion, to enable new features, Eglot can have soft
dependencies on popular libraries that are not in Emacs core.
"Soft" means that the dependency doesn't impair any other use of
Eglot beyond that feature. Such is the case of the snippet
functionality, via the Yasnippet package, Markdown formatting of
at-point documentation via the markdown-mode package, and nicer
looking completions when the Company package is used.
Defined variables (56)
eglot--cached-server | A cached reference to the current Eglot server. |
eglot--change-idle-timer | Idle timer for didChange signals. |
eglot--current-flymake-report-fn | Current flymake report function for this buffer. |
eglot--diagnostics | Flymake diagnostics for this buffer. |
eglot--document-changed-hook | Internal hook for doing things when the document changes. |
eglot--highlights | Overlays for textDocument/documentHighlight. |
eglot--last-inserted-char | If non-nil, value of the last inserted character in buffer. |
eglot--lsp-interface-alist | Alist (INTERFACE-NAME . INTERFACE) of known external LSP interfaces. |
eglot--lsp-xref-refs | ‘xref’ objects for overriding ‘xref-backend-references’’s. |
eglot--managed-mode | Non-nil if Eglot--Managed mode is enabled. |
eglot--managed-mode-hook | Hook run after entering or leaving ‘eglot--managed-mode’. |
eglot--outstanding-inlay-hints-region | Jit-lock-calculated (FROM . TO) region with potentially outdated hints |
eglot--outstanding-inlay-regions-timer | Helper timer for ‘eglot--update-hints’ |
eglot--recent-changes | Recent buffer changes as collected by ‘eglot--before-change’. |
eglot--saved-bindings | Bindings saved by ‘eglot--setq-saving’. |
eglot--servers-by-project | Keys are projects. Values are lists of processes. |
eglot--temp-location-buffers | Helper variable for ‘eglot--collecting-xrefs’. |
eglot--uri-path-allowed-chars | Like ‘url-path-allowed-chars’ but more restrictive. |
eglot--workspace-symbols-cache | Cache of ‘workspace/Symbol’ results used by ‘xref-find-definitions’. |
eglot--{} | The empty JSON object. |
eglot-autoreconnect | Control ability to reconnect automatically to the LSP server. |
eglot-autoshutdown | If non-nil, shut down server after killing last managed buffer. |
eglot-command-history | History of CONTACT arguments to ‘eglot’. |
eglot-confirm-server-initiated-edits | Non-nil if server-initiated edits should be confirmed with user. |
eglot-connect-hook | Hook run after connecting in ‘eglot--connect’. |
eglot-connect-timeout | Number of seconds before timing out LSP connection attempts. |
eglot-current-column-function | Function calculating position relative to line beginning. |
eglot-current-linepos-function | Function calculating position relative to line beginning. |
eglot-diagnostics-map | Keymap active in Eglot-backed Flymake diagnostic overlays. |
eglot-events-buffer-size | Control the size of the Eglot events buffer. |
eglot-extend-to-xref | If non-nil, activate Eglot in cross-referenced non-project files. |
eglot-ignored-server-capabilites | LSP server capabilities that Eglot could use, but won’t. |
eglot-ignored-server-capabilities | LSP server capabilities that Eglot could use, but won’t. |
eglot-inlay-hints-mode | Non-nil if Eglot-Inlay-Hints mode is enabled. |
eglot-inlay-hints-mode-hook | Hook run after entering or leaving ‘eglot-inlay-hints-mode’. |
eglot-list-connections-mode-abbrev-table | Abbrev table for ‘eglot-list-connections-mode’. |
eglot-list-connections-mode-hook | Hook run after entering mode. |
eglot-list-connections-mode-map | Keymap for ‘eglot-list-connections-mode’. |
eglot-list-connections-mode-syntax-table | Syntax table for ‘eglot-list-connections-mode’. |
eglot-managed-mode-hook | A hook run by Eglot after it started/stopped managing a buffer. |
eglot-menu | Eglot |
eglot-menu-string | String displayed in mode line when Eglot is active. |
eglot-move-to-column-function | Function to move to a position within a line reported by the LSP server. |
eglot-move-to-linepos-function | Function to move to a position within a line reported by the LSP server. |
eglot-report-progress | If non-nil, show progress of long running LSP server work |
eglot-send-changes-idle-time | Don’t tell server of changes before Emacs’s been idle for this many seconds. |
eglot-server-initialized-hook | Hook run after a ‘eglot-lsp-server’ instance is created. |
eglot-server-menu | Monitor server communication |
eglot-server-programs | How the command ‘eglot’ guesses the server to start. |
eglot-stay-out-of | List of Emacs things that Eglot should try to stay of. |
eglot-strict-mode | How strictly to check LSP interfaces at compile- and run-time. |
eglot-sync-connect | Control blocking of LSP connection attempts. |
eglot-withhold-process-id | If non-nil, Eglot will not send the Emacs process id to the language server. |
eglot-workspace-configuration | Configure LSP servers specifically for a given project. |
eglot-xref-lessp-function | Compare two ‘xref-item’ objects for sorting. |
eglot-{} | The empty JSON object. |
Defined functions (181)
Defined faces (7)
eglot-diagnostic-tag-deprecated-face | Face used to render deprecated or obsolete code. |
eglot-diagnostic-tag-unnecessary-face | Face used to render unused or unnecessary code. |
eglot-highlight-symbol-face | Face used to highlight the symbol at point. |
eglot-inlay-hint-face | Face used for inlay hint overlays. |
eglot-mode-line | Face for package-name in Eglot's mode line. |
eglot-parameter-hint-face | Face used for parameter inlay hint overlays. |
eglot-type-hint-face | Face used for type inlay hint overlays. |