From 91e24c5b5a69495bcd706a5287c05bb5fd282700 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 23 Feb 2023 19:18:41 +0000 Subject: [PATCH] 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 -- 2.39.5