Fix: Flicker when move out and into a eldoc-able symbol quickly

- (eldox-box--eldoc-message-function): doesn't cleanup childframe
  when passed with nil anymore

I finally figured out why the flicker occurs:

1. when eldoc asks for doc string, elgot returns nil immeditaly
2. when you move out of a eldoc-cable symbol and move back in
   the childframe isn't cleaned up. Adn eldoc recieves nil from
   eglot, passes that to message function (eldoc-message)
   -> (eldoc-message-function), eldoc-box gets it and cleans up
   childframe. Then eglot recieved doc string from server
   and calls (eldoc-message), childframe is then redisplayed.

Since eldoc-box cleans up after itself and doesn't rely on eldoc
to cleanup. A quick fix is simply don't clean up when eldoc-box
(eldoc-box--eldoc-message-function) recieves nil from eldoc
(eldoc-message).
This commit is contained in:
Yuan Fu 2018-12-17 10:31:50 -05:00
parent 55bba3ed91
commit e02f496368
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901

View File

@ -229,7 +229,7 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
(defun eldoc-box--eldoc-message-function (str &rest args) (defun eldoc-box--eldoc-message-function (str &rest args)
"Front-end for eldoc. Display STR in childframe and ARGS works like `message'." "Front-end for eldoc. Display STR in childframe and ARGS works like `message'."
(if (stringp str) (when (stringp str)
(let ((doc (apply #'format str args))) (let ((doc (apply #'format str args)))
(unless (and eldoc-box-only-multi-line (eq (cl-count ?\n doc) 0)) (unless (and eldoc-box-only-multi-line (eq (cl-count ?\n doc) 0))
(eldoc-box--display doc) (eldoc-box--display doc)
@ -243,7 +243,6 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
;; command if `eldoc-box-hover-mode' is on and `eldoc-last-message' is not nil. ;; command if `eldoc-box-hover-mode' is on and `eldoc-last-message' is not nil.
(setq eldoc-box--cleanup-timer (setq eldoc-box--cleanup-timer
(run-with-timer 1 nil #'eldoc-box--maybe-cleanup)))) (run-with-timer 1 nil #'eldoc-box--maybe-cleanup))))
(eldoc-box-quit-frame)
t)) t))
(provide 'eldoc-box) (provide 'eldoc-box)