[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 31bfe21 24/45: Add support for code action litera
From: |
João Távora |
Subject: |
[elpa] externals/eglot 31bfe21 24/45: Add support for code action literals |
Date: |
Thu, 22 Nov 2018 19:15:30 -0500 (EST) |
branch: externals/eglot
commit 31bfe21567c29f02b9ad3690f53aff13a22974dd
Author: Michał Krzywkowski <address@hidden>
Commit: mkcms <address@hidden>
Add support for code action literals
Code action literals allow the server to simply return a WorkspaceEdit
for a code action, so the client does not have to execute a command.
* eglot.el (eglot-client-capabilities): Add :codeActionLiteralSupport.
(eglot--code-action-kinds): New variable.
(eglot-code-actions): Apply provided WorkspaceEdit.
---
eglot.el | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/eglot.el b/eglot.el
index e151704..b2e88d8 100644
--- a/eglot.el
+++ b/eglot.el
@@ -223,7 +223,12 @@ let the buffer grow forever."
:definition `(:dynamicRegistration :json-false)
:documentSymbol `(:dynamicRegistration :json-false)
:documentHighlight `(:dynamicRegistration :json-false)
- :codeAction `(:dynamicRegistration :json-false)
+ :codeAction (list
+ :dynamicRegistration :json-false
+ :codeActionLiteralSupport
+ `(:codeActionKind
+ (:valueSet
+ [,@eglot--code-action-kinds])))
:formatting `(:dynamicRegistration :json-false)
:rangeFormatting `(:dynamicRegistration :json-false)
:rename `(:dynamicRegistration :json-false)
@@ -740,6 +745,11 @@ Doubles as an indicator of snippet support."
(21 . "Null") (22 . "EnumMember") (23 . "Struct")
(24 . "Event") (25 . "Operator") (26 . "TypeParameter")))
+(defconst eglot--code-action-kinds
+ '("quickfix" "refactor" "refactor.extract"
+ "refactor.inline" "refactor.rewrite"
+ "source" "source.organizeImports"))
+
(defun eglot--format-markup (markup)
"Format MARKUP according to LSP's spec."
(pcase-let ((`(,string ,mode)
@@ -1788,8 +1798,10 @@ If SKIP-SIGNATURE, don't try to send
textDocument/signatureHelp."
(cdr (assoc 'eglot-lsp-diag
(eglot--diag-data diag))))
(flymake-diagnostics beg end))]))))
- (menu-items (mapcar (jsonrpc-lambda (&key title command arguments)
- `(,title . (:command ,command :arguments
,arguments)))
+ (menu-items (mapcar (jsonrpc-lambda (&key title command arguments
+ edit _kind _diagnostics)
+ `(,title . (:command ,command :arguments
,arguments
+ :edit ,edit)))
actions))
(menu (and menu-items `("Eglot code actions:" ("dummy"
,@menu-items))))
(command-and-args
@@ -1802,10 +1814,13 @@ If SKIP-SIGNATURE, don't try to send
textDocument/signatureHelp."
(if (eq (setq retval (tmm-prompt menu)) never-mind)
(keyboard-quit)
retval))))))
- (cl-destructuring-bind (&key _title command arguments) command-and-args
+ (cl-destructuring-bind (&key _title command arguments edit)
command-and-args
+ (when edit
+ (eglot--apply-workspace-edit edit))
(if command
(eglot-execute-command server (intern command) arguments)
- (eglot--message "No code actions here")))))
+ (unless edit
+ (eglot--message "No code actions here"))))))
- [elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls connection, (continued)
- [elpa] externals/eglot 6ebbd36 11/45: Add tests for eclipse.jdt.ls connection, João Távora, 2018/11/22
- [elpa] externals/eglot 22e5c57 18/45: Don't ignore unknown SymbolKinds in imenu, João Távora, 2018/11/22
- [elpa] externals/eglot 5ee05f9 16/45: Require subr-x at compile time (#139), João Távora, 2018/11/22
- [elpa] externals/eglot d9c3696 15/45: Fix #138: accept deprecated field in SymbolInformation, João Távora, 2018/11/22
- [elpa] externals/eglot 82ae4f6 21/45: Re-enable eclipse-jdt tests, João Távora, 2018/11/22
- [elpa] externals/eglot ee41f06 22/45: Slightly robustify test engine, João Távora, 2018/11/22
- [elpa] externals/eglot faf93ad 13/45: * eglot-tests.el: Disable eclipse connection tests., João Távora, 2018/11/22
- [elpa] externals/eglot c664f40 28/45: * eglot.el (eglot-client-capabilities): Mention supported SymbolKinds., João Távora, 2018/11/22
- [elpa] externals/eglot edc6538 32/45: Fix a bug introduced by previous bugfix, João Távora, 2018/11/22
- [elpa] externals/eglot d6e0ba3 31/45: * eglot-tests.el (eclipse-connect): Increase connect timeout to 20., João Távora, 2018/11/22
- [elpa] externals/eglot 31bfe21 24/45: Add support for code action literals,
João Távora <=
- [elpa] externals/eglot 11cd074 29/45: Support ocaml-language-server out of the box (#149), João Távora, 2018/11/22
- [elpa] externals/eglot 7b4ed97 33/45: Fix #124: add ability to move to LSP-precise columns, João Távora, 2018/11/22
- [elpa] externals/eglot f2ccb77 25/45: Simplify eglot-code-action. Fix compilation warning, João Távora, 2018/11/22
- [elpa] externals/eglot 2a410e9 30/45: Move constants to top instead of forward-declaring, João Távora, 2018/11/22
- [elpa] externals/eglot f74a80f 27/45: Make imenu hierarchical, João Távora, 2018/11/22
- [elpa] externals/eglot 118f966 26/45: Fix a bug when response to definitions request is a single location, João Távora, 2018/11/22
- [elpa] externals/eglot 3c180c0 19/45: Rework test macros for hopefully more stable testing, João Távora, 2018/11/22
- [elpa] externals/eglot b31ba80 35/45: Tweak solution to #125 with a hint from Fangrui Song, João Távora, 2018/11/22
- [elpa] externals/eglot fdb1941 36/45: Add support for TextEdits in completion, João Távora, 2018/11/22
- [elpa] externals/eglot d66f2eb 39/45: Treat tab characters as 1 column wide in position conversion functions, João Távora, 2018/11/22