Try to place lsp-ui-doc popups in less annoying places

This commit is contained in:
Adam Goldsmith 2021-05-26 00:51:23 -04:00
parent 7224ec283b
commit 674e7dc5aa

View File

@ -597,9 +597,21 @@
([remap xref-find-references] . lsp-ui-peek-find-references))
:config
(setq lsp-ui-sideline-ignore-duplicate t
lsp-ui-doc-max-height 10
lsp-ui-doc-max-height 5
lsp-ui-doc-max-width 70
;; lsp-ui-sideline-update-mode 'point
))
)
(defun adjust-lsp-ui-doc-frame-pos (orig-fun &rest args)
(let* ((y-position-in-window (nth 1 (pos-visible-in-window-p (point) nil t)))
(edges (window-absolute-body-pixel-edges))
(bottom-edge (- (nth 3 edges) (nth 1 edges)))
(lsp-ui-doc-max-height (/ (window-height) 5))
(lsp-ui-doc-position (if (< (/ (float y-position-in-window) bottom-edge) 0.5) 'bottom 'top)))
(when (lsp-ui-doc--get-frame)
(lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
(apply orig-fun args)))
(advice-add 'lsp-ui-doc--display :around #'adjust-lsp-ui-doc-frame-pos))
(use-package lsp-python-ms :demand :if (package-installed-p 'lsp-python-ms))