emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot c8191b2 32/62: Improve eglot-execute-command API


From: Stefan Monnier
Subject: [elpa] externals/eglot c8191b2 32/62: Improve eglot-execute-command API to ease overriding by servers
Date: Sat, 29 Sep 2018 17:13:33 -0400 (EDT)

branch: externals/eglot
commit c8191b24e25ba4bc8f4f0e972d5f0084f9280d09
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Improve eglot-execute-command API to ease overriding by servers
    
    * eglot.el (eglot-execute-command): COMMAND can be a symbol.
    (eglot-code-actions): Pass symbols to eglot-command.
---
 eglot.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/eglot.el b/eglot.el
index e250ce0..e37ec94 100644
--- a/eglot.el
+++ b/eglot.el
@@ -159,7 +159,7 @@ lasted more than that many seconds."
   "Handle SERVER's METHOD notification with PARAMS.")
 
 (cl-defgeneric eglot-execute-command (server command arguments)
-  "Execute on SERVER COMMAND with ARGUMENTS.")
+  "Ask SERVER to execute COMMAND with ARGUMENTS.")
 
 (cl-defgeneric eglot-initialization-options (server)
   "JSON object to send under `initializationOptions'"
@@ -891,11 +891,10 @@ Uses THING, FACE, DEFS and PREPEND."
 
 (cl-defmethod eglot-execute-command
   (server command arguments)
-  "Execute command by making a :workspace/executeCommand request."
-  (jsonrpc-request
-   server
-   :workspace/executeCommand
-   `(:command ,command :arguments ,arguments)))
+  "Execute COMMAND on SERVER with `:workspace/executeCommand'.
+COMMAND is a symbol naming the command."
+  (jsonrpc-request server :workspace/executeCommand
+                   `(:command ,(format "%s" command) :arguments ,arguments)))
 
 (cl-defmethod eglot-handle-notification
   (_server (_method (eql window/showMessage)) &key type message)
@@ -1586,10 +1585,10 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
                    (if (eq (setq retval (tmm-prompt menu)) never-mind)
                        (keyboard-quit)
                      retval))))))
-    (if command-and-args
-        (eglot-execute-command server (plist-get command-and-args :command)
-                               (plist-get command-and-args :arguments))
-      (eglot--message "No code actions here"))))
+    (cl-destructuring-bind (&key _title command arguments) command-and-args
+      (if command
+          (eglot-execute-command server (intern command) arguments)
+        (eglot--message "No code actions here")))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]