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

WIP: Fix for #369 #371

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
21 changes: 16 additions & 5 deletions lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ option."
'((((background light)) :background "#b3b3b3")
(t :background "#272A36"))
"Background color of the documentation.
Only the `background' is used in this face."
Do not set any other attributes than `background' in this face."
:group 'lsp-ui-doc)

(defface lsp-ui-doc-header
Expand Down Expand Up @@ -313,8 +313,7 @@ We don't extract the string that `lps-line' is already displaying."
"Set background color of the WebKit widget."
(lsp-ui-doc--webkit-execute-script
(format "document.body.style.background = '%s';"
"#fdfdfd"
;; (face-attribute 'lsp-ui-doc-background :background)
(face-attribute 'lsp-ui-doc-background :background)
)))

(defun lsp-ui-doc--webkit-set-foreground ()
Expand Down Expand Up @@ -530,7 +529,7 @@ FN is the function to call on click."

(defun lsp-ui-doc--inline-padding (string len)
(let ((string (concat " " string (make-string (- len (string-width string)) ?\s) " ")))
(add-face-text-property 0 (length string) (list :background (face-background 'lsp-ui-doc-background nil t)) t string)
(add-face-text-property 0 (length string) 'lsp-ui-doc-background t string)
string))

(defun lsp-ui-doc--inline-faking-frame (doc-strings)
Expand Down Expand Up @@ -722,7 +721,19 @@ before, or if the new window is the minibuffer."

(advice-add #'select-window :around #'lsp-ui--hide-doc-frame-on-window-change)

(advice-add 'load-theme :before (lambda (&rest _) (lsp-ui-doc--delete-frame)))
;; Theme changes won't update background color and fringe width automatically.
;; Using advice to make that work.
(defun lsp-ui-doc--update-frame-settings (&rest _ignore)
(if-let (frame (lsp-ui-doc--get-frame))
(if lsp-ui-doc-use-webkit
(lsp-ui-doc--webkit-set-background)
(set-frame-parameter
frame 'left-fringe (frame-char-width))
(set-frame-parameter
frame 'background-color (face-background 'lsp-ui-doc-background nil t)))))
(advice-add 'load-theme :after #'lsp-ui-doc--update-frame-settings)
(advice-add 'custom-set-faces :after #'lsp-ui-doc--update-frame-settings)

(add-hook 'window-configuration-change-hook #'lsp-ui-doc--hide-frame)

(defun lsp-ui-doc--on-delete (frame)
Expand Down