emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 91e24c5b5a6: Eglot: update inlay hints on window configuration


From: João Távora
Subject: emacs-29 91e24c5b5a6: Eglot: update inlay hints on window configuration changes
Date: Thu, 23 Feb 2023 14:20:59 -0500 (EST)

branch: emacs-29
commit 91e24c5b5a69495bcd706a5287c05bb5fd282700
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: update inlay hints on window configuration changes
    
    * lisp/progmodes/eglot.el
    (eglot--inlay-hints-after-window-config-change): New helper.
    (eglot-inlay-hints-mode): Use it.
---
 lisp/progmodes/eglot.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 7b4251a1242..eea8be6d1aa 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3572,6 +3572,9 @@ This value is only meaningful if the minor mode
                                                  (window-end window))
                           (wsetq eglot--inlay-hints-timer nil))))))))))
 
+(defun eglot--inlay-hints-after-window-config-change ()
+  (eglot--update-hints-1 (window-start) (window-end)))
+
 (define-minor-mode eglot-inlay-hints-mode
   "Minor mode for annotating buffers with LSP server's inlay hints."
   :global nil
@@ -3585,6 +3588,8 @@ This value is only meaningful if the minor mode
                      #'eglot--inlay-hints-lazily t t)
            (add-hook 'window-scroll-functions
                      #'eglot--inlay-hints-after-scroll nil t)
+           (add-hook 'window-configuration-change-hook
+                     #'eglot--inlay-hints-after-window-config-change nil t)
            ;; Maybe there isn't a window yet for current buffer,
            ;; so `run-at-time' ensures this runs after redisplay.
            (run-at-time 0 nil #'eglot--inlay-hints-lazily))
@@ -3593,6 +3598,8 @@ This value is only meaningful if the minor mode
                      #'eglot--inlay-hints-fully nil t)
            (eglot--inlay-hints-fully))))
         (t
+         (remove-hook 'window-configuration-change-hook
+                      #'eglot--inlay-hints-after-window-config-change)
          (remove-hook 'eglot--document-changed-hook
                       #'eglot--inlay-hints-lazily t)
          (remove-hook 'eglot--document-changed-hook



reply via email to

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