[Top][All Lists]

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

[elpa] externals/eglot 8e1a91b 31/62: Add a generic eglot-execute-comman

From: Stefan Monnier
Subject: [elpa] externals/eglot 8e1a91b 31/62: Add a generic eglot-execute-command API
Date: Sat, 29 Sep 2018 17:13:32 -0400 (EDT)

branch: externals/eglot
commit 8e1a91b1bb0e7c932d3bbe84c0b742019ea5b7b0
Author: Michał K <address@hidden>
Commit: João Távora <address@hidden>

    Add a generic eglot-execute-command API
    * eglot.el (eglot-execute-command): New defgeneric and method.  Use it
      to request :workspace/executeCommand.
    (eglot-code-actions): Use it.
 eglot.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 9e16d43..e250ce0 100644
--- a/eglot.el
+++ b/eglot.el
@@ -158,6 +158,9 @@ lasted more than that many seconds."
 (cl-defgeneric eglot-handle-notification (server method id &rest params)
   "Handle SERVER's METHOD notification with PARAMS.")
+(cl-defgeneric eglot-execute-command (server command arguments)
+  "Execute on SERVER COMMAND with ARGUMENTS.")
 (cl-defgeneric eglot-initialization-options (server)
   "JSON object to send under `initializationOptions'"
   (:method (_s) nil)) ; blank default
@@ -886,6 +889,14 @@ Uses THING, FACE, DEFS and PREPEND."
   "Handle unknown request"
   (jsonrpc-error "Unknown request method `%s'" method))
+(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)))
 (cl-defmethod eglot-handle-notification
   (_server (_method (eql window/showMessage)) &key type message)
   "Handle notification window/showMessage"
@@ -1576,7 +1587,8 @@ If SKIP-SIGNATURE, don't try to send 
     (if command-and-args
-        (jsonrpc-request server :workspace/executeCommand 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"))))

reply via email to

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