aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJoão Távora2025-01-26 23:26:51 +0000
committerJoão Távora2025-01-28 11:04:21 +0000
commitd6a502fc7a69dfa11aa100da5966a6962a82f613 (patch)
treeb3b50646ad931a0fe9d04fb3b3922a71fd8b0e24 /doc
parent7f0ef9655cdc28c3b8055e32c9e84ea57339b139 (diff)
downloademacs-d6a502fc7a69dfa11aa100da5966a6962a82f613.tar.gz
emacs-d6a502fc7a69dfa11aa100da5966a6962a82f613.zip
Eglot: suggest code actions at point
* lisp/progmodes/eglot.el (eglot-code-action-indicator-face): New face. (eglot-code-action-indications, eglot-code-action-indicator): New defcustoms. (eglot--highlights): Move up here. (eglot--managed-mode): Rework. (eglot--server-menu-map, eglot--main-menu-map): Extract maps into variables (avoids odd mode-line bug). (eglot--mode-line-format): Rework. (eglot--code-action-params): New helper. (eglot-code-actions): Rework. (eglot--read-execute-code-action): Tweak. (eglot-code-action-suggestion): New function. * etc/EGLOT-NEWS: Mention new feature. * doc/misc/eglot.texi (Eglot Features): Mention new feature. (Customization Variables): Mention new variables.
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/eglot.texi34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi
index 47649455cec..93675210c59 100644
--- a/doc/misc/eglot.texi
+++ b/doc/misc/eglot.texi
@@ -439,6 +439,13 @@ command (@pxref{Symbol Completion,,, emacs, GNU Emacs Manual}). This
439uses the language-server's parser data for the completion candidates. 439uses the language-server's parser data for the completion candidates.
440 440
441@item 441@item
442Server-suggested code refactorings. The ElDoc package is also leveraged
443to retrieve so-called @dfn{code actions} nearby point. When such
444suggestions are available they are annotated with a special indication
445and can be easily invoked by the user with the @code{eglot-code-action}
446command (@pxref{Eglot Commands}).
447
448@item
442On-the-fly succinct informative annotations, so-called @dfn{inlay 449On-the-fly succinct informative annotations, so-called @dfn{inlay
443hints}. Eglot adds special intangible text nearby certain identifiers, 450hints}. Eglot adds special intangible text nearby certain identifiers,
444be it the type of a variable, or the name of a formal parameter in a 451be it the type of a variable, or the name of a formal parameter in a
@@ -926,6 +933,31 @@ Setting this variable to true causes Eglot to send special cancellation
926notification for certain stale client request. This may help some LSP 933notification for certain stale client request. This may help some LSP
927servers avoid doing costly but ultimately useless work on behalf of the 934servers avoid doing costly but ultimately useless work on behalf of the
928client, improving overall performance. 935client, improving overall performance.
936
937@item eglot-code-action-indications
938This variable controls the indication of code actions available at
939point. Value is a list of symbols, more than one can be specified:
940
941@itemize @minus
942@item
943@code{eldoc-hint}: ElDoc is used to hint about at-point actions.
944@item
945@code{margin}: A special indicator appears in the margin of the line
946that point is currently on. This indicator is not interactive (you
947cannot click on it with the mouse).
948@item
949@code{nearby}: An interactive special indicator appears near point.
950@item
951@code{mode-line}: An interactive special indicator appears in the mode
952line.
953@end itemize
954
955@code{margin} and @code{nearby} are incompatible. If the list is empty,
956ElDoc will not hint about at-point actions.
957
958@item eglot-code-action-indicator
959This variable is a string determining what the special indicator looks
960like.
929@end vtable 961@end vtable
930 962
931@node Other Variables 963@node Other Variables
@@ -1004,6 +1036,8 @@ about an identifier.
1004signature information. 1036signature information.
1005@item @code{eglot-highlight-eldoc-function}, to highlight nearby 1037@item @code{eglot-highlight-eldoc-function}, to highlight nearby
1006manifestations of an identifier. 1038manifestations of an identifier.
1039@item @code{eglot-code-action-suggestion}, to retrieve relevant code
1040actions at point.
1007@end itemize 1041@end itemize
1008 1042
1009A simple tweak to remove at-point identifier information for 1043A simple tweak to remove at-point identifier information for