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 (86)
eglot--TextDocumentIdentifier-cache | LSP TextDocumentIdentifier-related cached info for current buffer. |
eglot--cached-server | A cached reference to the current Eglot server. |
eglot--capf-session | A cache used by ‘eglot-completion-at-point’. |
eglot--change-idle-timer | Idle timer for didChange signals. |
eglot--diagnostics | A list (DIAGNOSTICS VERSION RESULT-ID) for current buffer. |
eglot--docver | LSP document version. Bumped on ‘eglot--after-change’. |
eglot--flymake-push-report-fn | Current flymake report function for this buffer. |
eglot--highlights | Overlays for ‘eglot-highlight-eldoc-function’. |
eglot--inflight-async-requests | An plist of symbols to lists of JSONRPC ids. |
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--semtok-state | Plist describing current semtok state. |
eglot--send-changes-hook | Internal hook for doing things when the document changes. |
eglot--servers-by-project | Keys are projects. Values are lists of processes. |
eglot--suggestion-overlay | Overlay for ‘eglot-code-action-suggestion’. |
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-advertise-cancellation | If non-nil, Eglot attempts to inform server of canceled requests. |
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-cache-session-completions | If non-nil Eglot caches data during completion sessions. |
eglot-code-action-indications | How Eglot indicates there’s are code actions available at point. |
eglot-code-action-indicator | Indicator string for code action suggestions. |
eglot-command-history | History of CONTACT arguments to ‘eglot’. |
eglot-confirm-server-edits | Control if changes proposed by LSP should be confirmed with user. |
eglot-confirm-server-initiated-edits | Control if changes proposed by LSP should be confirmed with user. |
eglot-connect-hook | Hook run after connecting to a server. |
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-config | Configure the Eglot events buffer. |
eglot-extend-to-xref | If non-nil, activate Eglot in cross-referenced non-project files. |
eglot-hierarchy-label-map | Keymap active in labels Eglot hierarchy buffers. |
eglot-hierarchy-mode-abbrev-table | Abbrev table for ‘eglot-hierarchy-mode’. |
eglot-hierarchy-mode-hook | Hook run after entering ‘eglot-hierarchy-mode’. |
eglot-hierarchy-mode-map | Keymap for ‘eglot-hierarchy-mode’. |
eglot-hierarchy-mode-syntax-table | Syntax table for ‘eglot-hierarchy-mode’. |
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 ‘eglot-list-connections-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-lsp-context | Dynamically non-nil when searching for projects in LSP context. |
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-mode-line-action-suggestion | Eglot mode line construct for at-point code actions. |
eglot-mode-line-error | Eglot mode line construct for LSP errors. |
eglot-mode-line-format | Mode line construct for customizing Eglot information. |
eglot-mode-line-menu | Eglot mode line construct for Eglot’s main menu. |
eglot-mode-line-pending-requests | Eglot mode line construct for number of pending LSP requests. |
eglot-mode-line-progress | Eglot mode line construct for LSP progress reports. |
eglot-mode-line-session | Eglot mode line construct for project/LSP session. |
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-prefer-plaintext | If non-nil, always request plaintext responses to hover requests. |
eglot-report-progress | If non-nil, show progress of long running LSP server work. |
eglot-semantic-token-modifiers | LSP-supplied semantic modifiers Eglot should consider. |
eglot-semantic-token-types | LSP-supplied semantic types Eglot should consider. |
eglot-semantic-tokens-mode | Non-nil if Eglot-Semantic-Tokens mode is enabled. |
eglot-semantic-tokens-mode-hook | Hook run after entering or leaving ‘eglot-semantic-tokens-mode’. |
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 | Manage 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-watch-files-outside-project-root | If non-nil, allow watching files outside project root |
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 (223)
Defined faces (41)
eglot-code-action-indicator-face | Face used for code action suggestions. |
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-semantic-abstract | Face for painting a ‘abstract’ LSP semantic token |
eglot-semantic-async | Face for painting a ‘async’ LSP semantic token |
eglot-semantic-class | Face for painting a ‘class’ LSP semantic token |
eglot-semantic-comment | Face for painting a ‘comment’ LSP semantic token |
eglot-semantic-declaration | Face for painting a ‘declaration’ LSP semantic token |
eglot-semantic-decorator | Face for painting a ‘decorator’ LSP semantic token |
eglot-semantic-defaultLibrary | Face for painting a ‘defaultLibrary’ LSP semantic token |
eglot-semantic-definition | Face for painting a ‘definition’ LSP semantic token |
eglot-semantic-deprecated | Face for painting a ‘deprecated’ LSP semantic token |
eglot-semantic-documentation | Face for painting a ‘documentation’ LSP semantic token |
eglot-semantic-enum | Face for painting a ‘enum’ LSP semantic token |
eglot-semantic-enumMember | Face for painting a ‘enumMember’ LSP semantic token |
eglot-semantic-event | Face for painting a ‘event’ LSP semantic token |
eglot-semantic-function | Face for painting a ‘function’ LSP semantic token |
eglot-semantic-interface | Face for painting a ‘interface’ LSP semantic token |
eglot-semantic-keyword | Face for painting a ‘keyword’ LSP semantic token |
eglot-semantic-macro | Face for painting a ‘macro’ LSP semantic token |
eglot-semantic-method | Face for painting a ‘method’ LSP semantic token |
eglot-semantic-modification | Face for painting a ‘modification’ LSP semantic token |
eglot-semantic-modifier | Face for painting a ‘modifier’ LSP semantic token |
eglot-semantic-namespace | Face for painting a ‘namespace’ LSP semantic token |
eglot-semantic-number | Face for painting a ‘number’ LSP semantic token |
eglot-semantic-operator | Face for painting a ‘operator’ LSP semantic token |
eglot-semantic-parameter | Face for painting a ‘parameter’ LSP semantic token |
eglot-semantic-property | Face for painting a ‘property’ LSP semantic token |
eglot-semantic-readonly | Face for painting a ‘readonly’ LSP semantic token |
eglot-semantic-regexp | Face for painting a ‘regexp’ LSP semantic token |
eglot-semantic-static | Face for painting a ‘static’ LSP semantic token |
eglot-semantic-string | Face for painting a ‘string’ LSP semantic token |
eglot-semantic-struct | Face for painting a ‘struct’ LSP semantic token |
eglot-semantic-type | Face for painting a ‘type’ LSP semantic token |
eglot-semantic-typeParameter | Face for painting a ‘typeParameter’ LSP semantic token |
eglot-semantic-variable | Face for painting a ‘variable’ LSP semantic token |
eglot-type-hint-face | Face used for type inlay hint overlays. |