From 942eeecc3d9a23ad006a3476885dfa7cbb5e207e Mon Sep 17 00:00:00 2001 From: Nikita Danilov Date: Sat, 30 Mar 2024 15:27:20 -0700 Subject: [PATCH] Add an option to display the doc on the left. (#770) --- README.md | 5 +++-- lsp-ui-doc.el | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b13b7756..a952a4bc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lsp-ui-doc.el b/lsp-ui-doc.el index 4f113cd1..23f4358f 100644 --- a/lsp-ui-doc.el +++ b/lsp-ui-doc.el @@ -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." @@ -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)