Hide childframe when company pops up

An attempt to fix the issue mentioned in #11
This commit is contained in:
Yuan Fu 2019-06-06 21:17:37 +08:00
parent c97fe860fa
commit 5dbd37009e
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -377,6 +377,35 @@ If (point) != last point, cleanup frame.")
(setq eldoc-box-eglot-help-at-point-last-point (point)) (setq eldoc-box-eglot-help-at-point-last-point (point))
(run-with-timer 0.1 nil #'eldoc-box--eglot-help-at-point-cleanup))) (run-with-timer 0.1 nil #'eldoc-box--eglot-help-at-point-cleanup)))
;;;; Comany compatibility
;;
;; Hide childframe when company pops up
(defvar eldoc-box--chilframe-visible-before-company-popup nil
"Set to t if company kills childframe for its popup.")
(defun eldoc-box--company-on-hook (&rest _)
"Hide at-point doc when company popup show up."
(eldoc-box-hover-mode -1)
(when eldoc-box-hover-at-point-mode
(eldoc-box-quit-frame)))
(defun eldoc-box--company-cancel-hook (&rest _)
"Show doc when company canceled completion."
(eldoc-box-hover-mode)
(when (and eldoc-box-hover-at-point-mode
eldoc-box--chilframe-visible-before-company-popup)
(eldoc-box-show-frame)))
(defun eldoc-box--company-finish-hook (&rest _)
"Show doc when company finished completion."
(eldoc-box--company-cancel-hook))
(with-eval-after-load 'company
(add-hook 'company-completion-started-hook #'eldoc-box--company-on-hook t)
(add-hook 'company-completion-cancelled-hook #'eldoc-box--company-cancel-hook t)
(add-hook 'company-completion-finished-hook #'eldoc-box--company-finish-hook t))
(provide 'eldoc-box) (provide 'eldoc-box)
;;; eldoc-box.el ends here ;;; eldoc-box.el ends here