branch: externals/eglot
commit 92bf3a0485b4af11c0915bd3467e21c7b4bfe21a
Author: João Távora <joaotav...@gmail.com>
Commit: João Távora <joaotav...@gmail.com>

    Signal textDocument/didClose
    
    * eglot.el (eglot-editing-mode): Signal didClose.
    (eglot--signalDidClose): New.
---
 eglot.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 12e7fef..8584440 100644
--- a/eglot.el
+++ b/eglot.el
@@ -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

Reply via email to