summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-02-23 19:18:41 +0000
committerJoão Távora <joaotavora@gmail.com>2023-02-23 19:20:34 +0000
commit91e24c5b5a69495bcd706a5287c05bb5fd282700 (patch)
tree1f5aed2684e180178e42f9e3c8623d5694c98c7b
parent79fead1709f8913b6e529c5f4734fcd0c08129c3 (diff)
downloademacs-91e24c5b5a69495bcd706a5287c05bb5fd282700.tar.gz
emacs-91e24c5b5a69495bcd706a5287c05bb5fd282700.tar.bz2
emacs-91e24c5b5a69495bcd706a5287c05bb5fd282700.zip
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.
-rw-r--r--lisp/progmodes/eglot.el7
1 files changed, 7 insertions, 0 deletions
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