Next: , Up: Customizing Eglot [Contents][Index]


4.1 Customization Variables

This section provides a reference for the Eglot user options.

eglot-autoreconnect

This option controls the ability to reconnect automatically to the language server when Eglot detects that the server process terminated unexpectedly. The default value 3 means to attempt reconnection only if the previous successful connection lasted for more than that number of seconds; a different positive value changes the minimal length of the connection to trigger reconnection. A value of t means always reconnect automatically, and nil means never reconnect (in which case you will need to reconnect manually using M-x eglot).

eglot-connect-timeout

This specifies the number of seconds before connection attempt to a language server times out. The value of nil means never time out. The default is 30 seconds.

eglot-sync-connect

This setting is mainly important for connections which are slow to establish. Whereas the variable eglot-connect-timeout controls how long to wait for, this variable controls whether to block Emacs’s user interface while waiting. The default value is 3; a positive value means block for that many seconds, then wait for the connection in the background. The value of t means block during the whole waiting period. The value of nil or 0 means don’t block at all during the waiting period.

eglot-events-buffer-config

This configures the size and format of the Eglot events buffer. See eglot-events-buffer, for how to access that buffer. If the value is changed, the connection should be restarted using M-x eglot-reconnect for the new value to take effect. See Troubleshooting Eglot, for when this could be useful.

eglot-autoshutdown

If this is non-nil, Eglot shuts down a language server when the last buffer managed by it is killed. See Shutting Down LSP Servers. The default is nil; if you want to shut down a server, use M-x eglot-shutdown (see Eglot Commands).

eglot-confirm-server-edits

Various Eglot commands and code actions result in the language server sending editing commands to Emacs. If this option’s value is non-nil, Eglot will ask for confirmation before performing edits proposed by the language server. This option’s value can be crafted to require this confirmation for specific commands or only when the edit affects files not yet visited by the user. Consult this option’s docstring for more information.

eglot-ignored-server-capabilities

This variable’s value is a list of language server capabilities that Eglot should not use. The default is nil: Eglot uses all of the capabilities supported by each server.

eglot-extend-to-xref

If this is non-nil, and M-. (xref-find-definitions) lands you in a file outside of your project, such as a system-installed library or header file, transiently consider that file as managed by the same language server. That file is still outside your project (i.e. project-find-file won’t find it), but Eglot and the server will consider it to be part of the workspace. The default is nil.

eglot-documentation-renderer

This variable controls how Eglot renders at-point documentation imported from the server (see Eglot Features). The default value is nil, meaning Eglot selects a suitable Markdown renderer on each use—for example, gfm-view-mode from markdown-mode on NonGNU ELPA, which enhances documentation through fontification and other formatting. If you set it to t, plain text is requested from the server and no rendering is attempted. See docstring for more options.

eglot-mode-map

This variable is the keymap for binding Eglot-related command. It is in effect only as long as the buffer is managed by Eglot. By default, it is empty, with the single exception: C-h . is remapped to invoke eldoc-doc-buffer. You can bind additional commands in this map. For example:

 (define-key eglot-mode-map (kbd "C-c r") 'eglot-rename)
 (define-key eglot-mode-map (kbd "C-c o") 'eglot-code-action-organize-imports)
 (define-key eglot-mode-map (kbd "C-c h") 'eldoc)
 (define-key eglot-mode-map (kbd "<f6>") 'xref-find-definitions)
 (define-key eglot-mode-map (kbd "<f7>") 'eglot-momentary-inlay-hints)
eglot-report-progress

Set this variable to non-nil if you’d like progress notifications coming from the language server to be handled by Emacs’s progress reporting facilities. If the value is the symbol messages the message buffer is used, else the progress is reported in the mode line.

eglot-advertise-cancellation

Setting this variable to true causes Eglot to send special cancellation notification for certain stale client request. This may help some LSP servers avoid doing costly but ultimately useless work on behalf of the client, improving overall performance.

eglot-code-action-indications

This variable controls the indication of code actions available at point. Value is a list of symbols, more than one can be specified:

  • eldoc-hint: ElDoc is used to hint about at-point actions.
  • margin: A special indicator appears in the margin of the line that point is currently on.
  • nearby: An interactive special indicator appears near point.
  • mode-line: An interactive special indicator appears in the mode line.

margin and nearby are incompatible. If the list is empty, ElDoc will not hint about at-point actions.

eglot-code-action-indicator

This variable is a string determining what the special indicator looks like.

eglot-mode-line-format

This variables controls the shape and look of Eglot’s mode line. Its value is a mode line “construct”, generally a list of symbols and strings. The following symbols are meaningful and useful for Eglot’s mode line:

  • eglot-mode-line-menu: access Eglot’s main menu. See also eglot-menu-string;
  • eglot-mode-line-session: indicate current project and access current session’s menu;
  • eglot-mode-line-error: an indication of recent LSP errors;
  • eglot-mode-line-pending-requests: number of pending LSP requests;
  • eglot-mode-line-progress: progress reporter widgets;
  • eglot-mode-line-action-suggestion: LSP code actions at point.

Next: Other Variables, Up: Customizing Eglot [Contents][Index]

AltStyle によって変換されたページ (->オリジナル) /