Fix: empty childframe when used with lsp-mode

lsp-mode returns empty string as documentation from time to time,
add a workaround to ignore that
This commit is contained in:
Yuan Fu 2018-12-28 21:45:38 -05:00
parent 2f5910325d
commit 03d075eda6
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901

View File

@ -169,15 +169,16 @@ You can use C-g to hide the doc."
(defun eldoc-box--display (str) (defun eldoc-box--display (str)
"Display STR in childframe." "Display STR in childframe."
(let ((doc-buffer (get-buffer-create eldoc-box--buffer))) (unless (equal str "") ; WORKAROUND lsp returns empty string from time to time
(with-current-buffer doc-buffer (let ((doc-buffer (get-buffer-create eldoc-box--buffer)))
(setq mode-line-format nil) (with-current-buffer doc-buffer
;; without this, clicking childframe will make doc buffer the current buffer (setq mode-line-format nil)
;; and `eldoc-box--maybe-cleanup' in `eldoc-box--cleanup-timer' will clear the childframe ;; without this, clicking childframe will make doc buffer the current buffer
(setq eldoc-box-hover-mode t) ;; and `eldoc-box--maybe-cleanup' in `eldoc-box--cleanup-timer' will clear the childframe
(erase-buffer) (setq eldoc-box-hover-mode t)
(insert str)) (erase-buffer)
(eldoc-box--get-frame doc-buffer))) (insert str))
(eldoc-box--get-frame doc-buffer))))
(defun eldoc-box--window-side () (defun eldoc-box--window-side ()