]> git.eshelyaron.com Git - emacs.git/commitdiff
Signal textdocument/didclose
authorJoão Távora <joaotavora@gmail.com>
Thu, 3 May 2018 10:49:24 +0000 (11:49 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 3 May 2018 10:49:24 +0000 (11:49 +0100)
* eglot.el (eglot-editing-mode): Signal didClose.
(eglot--signalDidClose): New.

lisp/progmodes/eglot.el

index 12e7fef08c4496ad94847bdfd29f69d4ad2416a7..85844409f34ed3df3b7b93be682ce4060704c718 100644 (file)
@@ -671,6 +671,7 @@ running.  INTERACTIVE is t if called interactively."
     (eglot-mode 1)
     (add-hook 'after-change-functions 'eglot--after-change nil t)
     (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t)
+    (add-hook 'kill-buffer-hook 'eglot--signalDidClose nil t)
     (flymake-mode 1)
     (if (eglot--current-process)
         (eglot--signalDidOpen)
@@ -679,7 +680,8 @@ running.  INTERACTIVE is t if called interactively."
         (eglot--warn "No process"))))
    (t
     (remove-hook 'flymake-diagnostic-functions 'eglot-flymake-backend t)
-    (remove-hook 'after-change-functions 'eglot--after-change t))))
+    (remove-hook 'after-change-functions 'eglot--after-change t)
+    (remove-hook 'kill-buffer-hook 'eglot--signalDidClose t))))
 
 (define-minor-mode eglot-mode
   "Minor mode for all buffers managed by EGLOT in some way."  nil
@@ -832,6 +834,12 @@ running.  INTERACTIVE is t if called interactively."
                  (eglot--obj :textDocument
                              (eglot--current-buffer-TextDocumentItem))))
 
+(defun eglot--signalDidClose ()
+  (eglot--notify (eglot--current-process-or-lose)
+                 :textDocument/didClose
+                 (eglot--obj :textDocument
+                             (eglot--current-buffer-TextDocumentItem))))
+
 (defun eglot--maybe-signal-didChange ()
   (when eglot--recent-changes
     (save-excursion