[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa b19b294 64/71: Close #558: handle LSP 3.15's isPre
From: |
João Távora |
Subject: |
[elpa] externals/elpa b19b294 64/71: Close #558: handle LSP 3.15's isPreferred code action property |
Date: |
Wed, 16 Dec 2020 11:42:27 -0500 (EST) |
branch: externals/elpa
commit b19b294198b1d05a5cc9dfcf9b5a236519fdbd7b
Author: Damien Merenne <damien@bloom-life.com>
Commit: João Távora <joaotavora@gmail.com>
Close #558: handle LSP 3.15's isPreferred code action property
* eglot.el (eglot--lsp-interface-alist): Add :isPreferred to CodeAction.
(eglot-client-capabilities): Announce :isPreferredSupport.
(eglot-code-actions): Consider preferred CodeAction item.
Co-authored-by: João Távora <joaotavora@gmail.com>
---
eglot.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/eglot.el b/eglot.el
index 60bc56e..bd3bb53 100644
--- a/eglot.el
+++ b/eglot.el
@@ -244,7 +244,7 @@ let the buffer grow forever."
(eval-and-compile
(defvar eglot--lsp-interface-alist
`(
- (CodeAction (:title) (:kind :diagnostics :edit :command))
+ (CodeAction (:title) (:kind :diagnostics :edit :command :isPreferred))
(ConfigurationItem () (:scopeUri :section))
(Command ((:title . string) (:command . string)) (:arguments))
(CompletionItem (:label)
@@ -576,7 +576,8 @@ treated as in `eglot-dbind'."
["quickfix"
"refactor" "refactor.extract"
"refactor.inline" "refactor.rewrite"
- "source" "source.organizeImports"])))
+ "source" "source.organizeImports"]))
+ :isPreferredSupport t)
:formatting `(:dynamicRegistration :json-false)
:rangeFormatting `(:dynamicRegistration :json-false)
:rename `(:dynamicRegistration :json-false)
@@ -2516,12 +2517,19 @@ code actions at point"
(cons title all))
actions)
(eglot--error "No code actions here")))
+ (preferred-action (cl-find-if
+ (jsonrpc-lambda (&key isPreferred
&allow-other-keys)
+ isPreferred)
+ actions))
(menu `("Eglot code actions:" ("dummy" ,@menu-items)))
(action (if (listp last-nonmenu-event)
(x-popup-menu last-nonmenu-event menu)
(cdr (assoc (completing-read "[eglot] Pick an action: "
menu-items nil t
- nil nil (car menu-items))
+ nil nil (or (plist-get
+ preferred-action
+ :title)
+ (car menu-items)))
menu-items)))))
(eglot--dcase action
(((Command) command arguments)
- [elpa] externals/elpa ee87519 41/71: Replace uses of project-roots with project-root, (continued)
- [elpa] externals/elpa ee87519 41/71: Replace uses of project-roots with project-root, João Távora, 2020/12/16
- [elpa] externals/elpa 3b01561 39/71: Close #459: rework computation of string given to Eldoc (again), João Távora, 2020/12/16
- [elpa] externals/elpa bf75312 35/71: Require Xref, Project and Eldoc from GNU ELPA, João Távora, 2020/12/16
- [elpa] externals/elpa 2b16952 44/71: Try to make hover-multiline-doc-locus test pass on Travis, João Távora, 2020/12/16
- [elpa] externals/elpa ac9239b 46/71: Fix small problems around Eglot's help buffer, João Távora, 2020/12/16
- [elpa] externals/elpa 433779d 49/71: * eglot.el (Package-Requires): Require Flymake 1.0.9 and eldoc 1.2.0, João Távora, 2020/12/16
- [elpa] externals/elpa e3ce64a 54/71: Fix #510: use a hash-table for storing resolved completions, João Távora, 2020/12/16
- [elpa] externals/elpa e5fefc7 56/71: Really unbreak eldoc-related tests, João Távora, 2020/12/16
- [elpa] externals/elpa 2172641 65/71: Fix #558: Don't force eglot-strict-mode completely in eglot--dcase, João Távora, 2020/12/16
- [elpa] externals/elpa f9a11fe 63/71: Per #300: Don't send JSON null (Elisp nil) down the wire, João Távora, 2020/12/16
- [elpa] externals/elpa b19b294 64/71: Close #558: handle LSP 3.15's isPreferred code action property,
João Távora <=
- [elpa] externals/elpa c34e2f6 50/71: Really install latest dependencies, João Távora, 2020/12/16
- [elpa] externals/elpa 5a2cde9 59/71: Close #511: add built-int support for Godot Engine, João Távora, 2020/12/16
- [elpa] externals/elpa 38971d3 66/71: Fix #367: don't let M-x fill-paragraph break didChange, João Távora, 2020/12/16
- [elpa] externals/elpa 8dd0a15 67/71: Fix #367: Robustify previous fix of onChange breakage, João Távora, 2020/12/16
- [elpa] externals/elpa a2fa9ab 21/71: Per #408: fontify markdown source code blocks by default, João Távora, 2020/12/16
- [elpa] externals/elpa c9230e8 20/71: Close #408: Declare markdown support iff gfm-view-mode installed, João Távora, 2020/12/16
- [elpa] externals/elpa 3483a2f 10/71: Tests: print contents of *EGLOT ...* buffers in batch mode., João Távora, 2020/12/16
- [elpa] externals/elpa e1e7362 07/71: Fix #445: don't reupdate help buffer if already rendered, João Távora, 2020/12/16
- [elpa] externals/elpa f7a7e33 15/71: Tweak docstring of eglot-server-programs, João Távora, 2020/12/16
- [elpa] externals/elpa eb29f7c 19/71: Close #450: always string-trim markup, João Távora, 2020/12/16