Skip to content

Commit

Permalink
[lsp-ui-doc] Conditionaly address issue #21
Browse files Browse the repository at this point in the history
If we move/resize the frame after making it visible, it makes a
flickering effect.
So we do it only on systems where the bug is present (os x)
  • Loading branch information
sebastiencs committed Jan 2, 2018
1 parent d9d91ff commit b6523db
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ SYMBOL."
mode-line-format nil
cursor-type nil)))

(defun lsp-ui-doc--buggy-system-p ()
"Return non-nil if there is a bug with frames on the system.
https://github.com/emacs-lsp/lsp-ui/issues/21"
(eq 'ns (window-system)))

(defun lsp-ui-doc--display (symbol string)
"Display the documentation on screen.
SYMBOL STRING."
Expand All @@ -361,9 +366,12 @@ SYMBOL STRING."
(lsp-ui-doc--render-buffer string symbol)
(unless (frame-live-p (lsp-ui-doc--get-frame))
(lsp-ui-doc--set-frame (lsp-ui-doc--make-frame)))
(unless (lsp-ui-doc--buggy-system-p)
(lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
(unless (frame-visible-p (lsp-ui-doc--get-frame))
(make-frame-visible (lsp-ui-doc--get-frame)))
(lsp-ui-doc--move-frame (lsp-ui-doc--get-frame))))
(when (lsp-ui-doc--buggy-system-p)
(lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))))

(defun lsp-ui-doc--make-frame ()
"Create the child frame and return it."
Expand Down

0 comments on commit b6523db

Please sign in to comment.