[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot f2ccb77 25/45: Simplify eglot-code-action. Fix co
From: |
João Távora |
Subject: |
[elpa] externals/eglot f2ccb77 25/45: Simplify eglot-code-action. Fix compilation warning |
Date: |
Thu, 22 Nov 2018 19:15:30 -0500 (EST) |
branch: externals/eglot
commit f2ccb7773e40aedc8c5e8f985dfbeaa80ab2f5fc
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Simplify eglot-code-action. Fix compilation warning
* eglot.el (eglot-code-actions): Simplify.
(eglot-client-capabilities): Mention supported codeActionKind's
directly.
(eglot--code-action-kinds): Remove.
---
eglot.el | 77 +++++++++++++++++++++++++++++++---------------------------------
1 file changed, 37 insertions(+), 40 deletions(-)
diff --git a/eglot.el b/eglot.el
index b2e88d8..2b683f8 100644
--- a/eglot.el
+++ b/eglot.el
@@ -226,9 +226,12 @@ let the buffer grow forever."
:codeAction (list
:dynamicRegistration :json-false
:codeActionLiteralSupport
- `(:codeActionKind
+ '(:codeActionKind
(:valueSet
- [,@eglot--code-action-kinds])))
+ ["quickfix"
+ "refactor" "refactor.extract"
+ "refactor.inline" "refactor.rewrite"
+ "source" "source.organizeImports"])))
:formatting `(:dynamicRegistration :json-false)
:rangeFormatting `(:dynamicRegistration :json-false)
:rename `(:dynamicRegistration :json-false)
@@ -745,11 +748,6 @@ 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)
@@ -1786,41 +1784,40 @@ If SKIP-SIGNATURE, don't try to send
textDocument/signatureHelp."
(unless (eglot--server-capable :codeActionProvider)
(eglot--error "Server can't execute code actions!"))
(let* ((server (eglot--current-server-or-lose))
- (actions (jsonrpc-request
- server
- :textDocument/codeAction
- (list :textDocument (eglot--TextDocumentIdentifier)
- :range (list :start (eglot--pos-to-lsp-position beg)
- :end (eglot--pos-to-lsp-position end))
- :context
- `(:diagnostics
- [,@(mapcar (lambda (diag)
- (cdr (assoc 'eglot-lsp-diag
- (eglot--diag-data diag))))
- (flymake-diagnostics beg end))]))))
- (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
- (and menu
- (if (listp last-nonmenu-event)
- (x-popup-menu last-nonmenu-event menu)
- (let ((never-mind (gensym)) retval)
- (setcdr (cadr menu)
- (cons `("never mind..." . ,never-mind) (cdadr
menu)))
- (if (eq (setq retval (tmm-prompt menu)) never-mind)
- (keyboard-quit)
- retval))))))
- (cl-destructuring-bind (&key _title command arguments edit)
command-and-args
+ (actions
+ (jsonrpc-request
+ server
+ :textDocument/codeAction
+ (list :textDocument (eglot--TextDocumentIdentifier)
+ :range (list :start (eglot--pos-to-lsp-position beg)
+ :end (eglot--pos-to-lsp-position end))
+ :context
+ `(:diagnostics
+ [,@(mapcar (lambda (diag)
+ (cdr (assoc 'eglot-lsp-diag
+ (eglot--diag-data diag))))
+ (flymake-diagnostics beg end))]))))
+ (menu-items
+ (or (mapcar (jsonrpc-lambda (&key title command arguments
+ edit _kind _diagnostics)
+ `(,title . (:command ,command :arguments ,arguments
+ :edit ,edit)))
+ actions)
+ (eglot--error "No code actions here")))
+ (menu `("Eglot code actions:" ("dummy" ,@menu-items)))
+ (action (if (listp last-nonmenu-event)
+ (x-popup-menu last-nonmenu-event menu)
+ (let ((never-mind (gensym)) retval)
+ (setcdr (cadr menu)
+ (cons `("never mind..." . ,never-mind) (cdadr
menu)))
+ (if (eq (setq retval (tmm-prompt menu)) never-mind)
+ (keyboard-quit)
+ retval)))))
+ (cl-destructuring-bind (&key _title command arguments edit) action
(when edit
(eglot--apply-workspace-edit edit))
- (if command
- (eglot-execute-command server (intern command) arguments)
- (unless edit
- (eglot--message "No code actions here"))))))
+ (when command
+ (eglot-execute-command server (intern command) arguments)))))
- [elpa] externals/eglot d9c3696 15/45: Fix #138: accept deprecated field in SymbolInformation, (continued)
- [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, 2018/11/22
- [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 <=
- [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
- [elpa] externals/eglot b731db5 41/45: Add support for R's languageserver (#161), João Távora, 2018/11/22
- [elpa] externals/eglot de1728c 44/45: * eglot.el (eglot-completion-at-point): Less chatter., João Távora, 2018/11/22
- [elpa] externals/eglot fc03d7c 40/45: Fix #160: Properly delete inserted text after completion, João Távora, 2018/11/22