Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add frame-left-or-right-other for lsp-ui-alignment #329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
(defcustom lsp-ui-doc-alignment 'frame
"How to align the doc."
:type '(choice (const :tag "Frame" frame)
(const :tag "Other (left or right) side of frame" frame-left-or-right-other)
(const :tag "Window" window))
:group 'lsp-ui-doc)

Expand Down Expand Up @@ -415,19 +416,32 @@ START-Y is the position y of the current window."
(char-h (frame-char-height))
(height (min (- (* lsp-ui-doc-max-height char-h) (/ char-h 2)) height))
(frame-right (pcase lsp-ui-doc-alignment
('frame (frame-pixel-width))
('window right)))
(frame-resize-pixelwise t))
('window right)
(_ (frame-pixel-width))))
(frame-resize-pixelwise t)
((window-left-edge window-top-edge window-right-edge _) (window-absolute-pixel-edges))
(window-left-right-center (/ (+ window-left-edge window-right-edge) 2))
((frame-left-edge frame-top-edge frame-right-edge _) (frame-edges))
(frame-left-right-center (/ (+ frame-left-edge frame-right-edge) 2)))
(set-frame-size frame width height t)
(if (eq lsp-ui-doc-position 'at-point)
(lsp-ui-doc--mv-at-point frame height left top)
(set-frame-position frame
(max (- frame-right width 10 (frame-char-width)) 10)
(if (and (eq lsp-ui-doc-alignment 'frame-left-or-right-other)
(> window-left-right-center frame-left-right-center))
10
(max (- frame-right width 10 (frame-char-width)) 10))
(pcase lsp-ui-doc-position
('top (+ top 10))
('bottom (- (lsp-ui-doc--line-height 'mode-line)
height
10)))))))
('top (pcase lsp-ui-doc-alignment
('window (+ top 10))
(_ 10)))
('bottom (pcase lsp-ui-doc-alignment
('window (- (+ (lsp-ui-doc--line-height 'mode-line) (- window-top-edge frame-top-edge))
height
10))
(_ (- (frame-pixel-height)
height
10)))))))))

(defun lsp-ui-doc--visit-file (filename)
"Visit FILENAME in the parent frame."
Expand Down