]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify `eglot--protocol-initialize`
authorJoão Távora <joaotavora@gmail.com>
Wed, 16 Aug 2017 14:48:50 +0000 (15:48 +0100)
committerJoão Távora <joaotavora@gmail.com>
Wed, 16 Aug 2017 15:56:34 +0000 (16:56 +0100)
* eglot.el (eglot--protocol-initialize): Simplify

lisp/progmodes/eglot.el

index cd91d7821cea49f9f2c7a457d426f772d63e3139..b59ee02ce3aed90ead2e6c9e5063f0e7e3c4dcd9 100644 (file)
@@ -70,7 +70,7 @@
   "Point where next unread message starts")
 
 (eglot--define-process-var eglot--short-name nil
-  "A short name")
+  "A short name for the process")
 
 (eglot--define-process-var eglot--expected-bytes nil
   "How many bytes declared by server")
@@ -81,6 +81,9 @@
 (eglot--define-process-var eglot--events-buffer nil
   "A buffer pretty-printing the EGLOT RPC events")
 
+(eglot--define-process-var eglot--capabilities :unreported
+  "Holds list of capabilities that server reported")
+
 (cl-defmacro eglot--request (process
                               method
                               params
                  :capabilities (:workspace (:executeCommand (:dynamicRegistration t))
                                            :textDocument (:synchronization (:didSave t))))
    (lambda (&key capabilities)
-     (cl-destructuring-bind
-         (&rest all
-                &key
-                ;; capabilities reported by server
-                _textDocumentSync
-                _hoverProvider
-                _completionProvider
-                _definitionProvider
-                _referencesProvider
-                _documentHighlightProvider
-                _documentSymbolProvider
-                _workspaceSymbolProvider
-                _codeActionProvider
-                _documentFormattingProvider
-                _documentRangeFormattingProvider
-                _renameProvider
-                _executeCommandProvider
-                )
-         capabilities
-       (when interactive
+     (setf (eglot--capabilities process) capabilities)
+     (when interactive
          (eglot--message
           "So yeah I got lots (%d) of capabilities"
-          (length all)))))))
+          (length capabilities))))))
 
 (defun eglot-quit-server (process &optional sync)
   (interactive (list (eglot--current-process-or-lose)))