]> git.eshelyaron.com Git - emacs.git/commitdiff
Organize a bit
authorJoão Távora <joaotavora@gmail.com>
Wed, 16 Aug 2017 11:50:53 +0000 (12:50 +0100)
committerJoão Távora <joaotavora@gmail.com>
Wed, 16 Aug 2017 12:52:00 +0000 (13:52 +0100)
lisp/progmodes/eglot.el

index c7f8774d8387b64f70fbf1cc134937509a776556..e3b288b0381c0098c3597dead5a7d3f77d144ebf 100644 (file)
                (format "\n-----------------------------------\n"))))
           (eglot--protocol-initialize proc interactive))))))
 
-(defun eglot-quit-server (process &optional sync)
-  (interactive (list (eglot--current-process-or-lose)))
-  (eglot--message "Asking server to terminate")
-  (eglot--request
-      process
-      :shutdown
-      nil
-      (lambda (&rest _anything)
-        (eglot--message "Now asking server to exit")
-        (process-put process 'eglot--moribund t)
-        (eglot--process-send process
-                              `(:jsonrpc  "2.0"
-                                          :method  :exit)))
-      :async-p (not sync)
-      :timeout-fn (lambda ()
-                    (eglot--warn "Brutally deleting existing process %s"
-                                  process)
-                    (process-put process 'eglot--moribund t)
-                    (delete-process process))))
 
 (defun eglot--process-sentinel (process change)
   (with-current-buffer (process-buffer process)
             (eglot--error "Process %s died unexpectedly" process))
           (accept-process-output nil 0.01))))))
 
+\f
+;;; Requests
+;;; 
 
 (defun eglot--protocol-initialize (process interactive)
   (eglot--request
    :initialize
    `(:processId  ,(emacs-pid)
                  :rootPath  ,(concat "" ;; FIXME RLS doesn't like "file://"
+                                     "file://"
                                      (expand-file-name (car (project-roots
                                                              (project-current)))))
                  :initializationOptions  []
           "So yeah I got lots (%d) of capabilities"
           (length all)))))))
 
-(defun eglot--debug (format &rest args)
+(defun eglot-quit-server (process &optional sync)
+  (interactive (list (eglot--current-process-or-lose)))
+  (eglot--message "Asking server to terminate")
+  (eglot--request
+      process
+      :shutdown
+      nil
+      (lambda (&rest _anything)
+        (eglot--message "Now asking server to exit")
+        (process-put process 'eglot--moribund t)
+        (eglot--process-send process
+                              `(:jsonrpc  "2.0"
+                                          :method  :exit)))
+      :async-p (not sync)
+      :timeout-fn (lambda ()
+                    (eglot--warn "Brutally deleting existing process %s"
+                                  process)
+                    (process-put process 'eglot--moribund t)
+                    (delete-process process))))
+
 \f
 ;;; Notifications
 ;;;
   "Handle notification publishDiagnostics"
   (eglot--message "So yeah I got %s for %s"
                   diagnostics uri))
+
+\f
+;;; Helpers
+;;;
+(defun
+    eglot--debug (format &rest args)
   (display-warning 'eglot
      (apply #'format format args)
      :debug))