diff options
| author | João Távora | 2025-01-26 23:26:51 +0000 |
|---|---|---|
| committer | João Távora | 2025-01-28 11:04:21 +0000 |
| commit | d6a502fc7a69dfa11aa100da5966a6962a82f613 (patch) | |
| tree | b3b50646ad931a0fe9d04fb3b3922a71fd8b0e24 /doc | |
| parent | 7f0ef9655cdc28c3b8055e32c9e84ea57339b139 (diff) | |
| download | emacs-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.texi | 34 |
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 | |||
| 439 | uses the language-server's parser data for the completion candidates. | 439 | uses the language-server's parser data for the completion candidates. |
| 440 | 440 | ||
| 441 | @item | 441 | @item |
| 442 | Server-suggested code refactorings. The ElDoc package is also leveraged | ||
| 443 | to retrieve so-called @dfn{code actions} nearby point. When such | ||
| 444 | suggestions are available they are annotated with a special indication | ||
| 445 | and can be easily invoked by the user with the @code{eglot-code-action} | ||
| 446 | command (@pxref{Eglot Commands}). | ||
| 447 | |||
| 448 | @item | ||
| 442 | On-the-fly succinct informative annotations, so-called @dfn{inlay | 449 | On-the-fly succinct informative annotations, so-called @dfn{inlay |
| 443 | hints}. Eglot adds special intangible text nearby certain identifiers, | 450 | hints}. Eglot adds special intangible text nearby certain identifiers, |
| 444 | be it the type of a variable, or the name of a formal parameter in a | 451 | be 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 | |||
| 926 | notification for certain stale client request. This may help some LSP | 933 | notification for certain stale client request. This may help some LSP |
| 927 | servers avoid doing costly but ultimately useless work on behalf of the | 934 | servers avoid doing costly but ultimately useless work on behalf of the |
| 928 | client, improving overall performance. | 935 | client, improving overall performance. |
| 936 | |||
| 937 | @item eglot-code-action-indications | ||
| 938 | This variable controls the indication of code actions available at | ||
| 939 | point. 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 | ||
| 946 | that point is currently on. This indicator is not interactive (you | ||
| 947 | cannot 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 | ||
| 952 | line. | ||
| 953 | @end itemize | ||
| 954 | |||
| 955 | @code{margin} and @code{nearby} are incompatible. If the list is empty, | ||
| 956 | ElDoc will not hint about at-point actions. | ||
| 957 | |||
| 958 | @item eglot-code-action-indicator | ||
| 959 | This variable is a string determining what the special indicator looks | ||
| 960 | like. | ||
| 929 | @end vtable | 961 | @end vtable |
| 930 | 962 | ||
| 931 | @node Other Variables | 963 | @node Other Variables |
| @@ -1004,6 +1036,8 @@ about an identifier. | |||
| 1004 | signature information. | 1036 | signature information. |
| 1005 | @item @code{eglot-highlight-eldoc-function}, to highlight nearby | 1037 | @item @code{eglot-highlight-eldoc-function}, to highlight nearby |
| 1006 | manifestations of an identifier. | 1038 | manifestations of an identifier. |
| 1039 | @item @code{eglot-code-action-suggestion}, to retrieve relevant code | ||
| 1040 | actions at point. | ||
| 1007 | @end itemize | 1041 | @end itemize |
| 1008 | 1042 | ||
| 1009 | A simple tweak to remove at-point identifier information for | 1043 | A simple tweak to remove at-point identifier information for |