Skip to content

Commit

Permalink
Add an option to display the doc on the left. (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitadanilov authored Mar 30, 2024
1 parent 547cc35 commit 942eeec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ Focus into lsp-ui-doc-frame

Customization:

- `lsp-ui-doc-enable` enable lsp-ui-doc
- `lsp-ui-doc-position` Where to display the doc
- `lsp-ui-doc-enable` Enable lsp-ui-doc
- `lsp-ui-doc-position` Where to display the doc (top, bottom or at-point)
- `lsp-ui-doc-side` Where to display the doc (left or right)
- `lsp-ui-doc-delay` Number of seconds before showing the doc
- `lsp-ui-doc-show-with-cursor` When non-nil, move the cursor over a symbol to show the doc
- `lsp-ui-doc-show-with-mouse` When non-nil, move the mouse pointer over a symbol to show the doc
Expand Down
10 changes: 9 additions & 1 deletion lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ This affects the position of the documentation when
(const :tag "At point" at-point))
:group 'lsp-ui-doc)

(defcustom lsp-ui-doc-side 'right
"Which side to display the doc."
:type '(choice (const :tag "Left" left)
(const :tag "Right" right))
:group 'lsp-ui-doc)

(defcustom lsp-ui-doc-alignment 'frame
"How to align the doc.
This only takes effect when `lsp-ui-doc-position' is `top or `bottom."
Expand Down Expand Up @@ -545,7 +551,9 @@ FRAME just below the symbol at point."
('window right)))
((left . top) (if (eq lsp-ui-doc-position 'at-point)
(lsp-ui-doc--mv-at-point width height left top)
(cons (max (- frame-right width char-w) 10)
(cons (pcase lsp-ui-doc-side
('right (max (- frame-right width char-w) 10))
('left 10))
(pcase lsp-ui-doc-position
('top (+ top char-w))
('bottom (- (lsp-ui-doc--line-height 'mode-line)
Expand Down

0 comments on commit 942eeec

Please sign in to comment.