3030
3131; ;; Code:
3232
33+ (require 'lsp-ui-util )
34+
3335(require 'lsp-protocol )
3436(require 'lsp-mode )
3537(require 'dash )
5254(declare-function xwidget-webkit-execute-script-rv " ext:xwidget" (xwidget script &optional default ))
5355(declare-function xwidget-resize " ext:xwidget" (xwidget new-width new-height))
5456
55- (declare-function lsp-ui-kill-timer 'lsp-ui )
56- (declare-function lsp-ui-delete-overlay 'lsp-ui )
57-
5857(defgroup lsp-ui-doc nil
5958 " Display informations of the current line."
6059 :group 'tools
6564
6665(defcustom lsp-ui-doc-enable t
6766 " Whether or not to enable lsp-ui-doc.
68- Displays documentation of the symbol at point on hover. This only takes effect
69- when a buffer is started."
67+ Displays documentation of the symbol at point on hover. This only takes effect when a buffer is started."
7068 :type 'boolean
7169 :group 'lsp-ui )
7270
@@ -183,31 +181,31 @@ Only the `background' is used in this face."
183181 :group 'lsp-ui-doc )
184182
185183(defvar lsp-ui-doc-frame-parameters
186- '((left . -1 )
187- (no-focus-on-map . t )
188- (min-width . 0 )
189- (width . 0 )
190- (min-height . 0 )
191- (height . 0 )
192- (internal-border-width . 1 )
193- (vertical-scroll-bars . nil )
194- (horizontal-scroll-bars . nil )
195- (right-fringe . 0 )
196- (menu-bar-lines . 0 )
197- (tool-bar-lines . 0 )
198- (tab-bar-lines . 0 )
184+ '((left . -1 )
185+ (no-focus-on-map . t )
186+ (min-width . 0 )
187+ (width . 0 )
188+ (min-height . 0 )
189+ (height . 0 )
190+ (internal-border-width . 1 )
191+ (vertical-scroll-bars . nil )
192+ (horizontal-scroll-bars . nil )
193+ (right-fringe . 0 )
194+ (menu-bar-lines . 0 )
195+ (tool-bar-lines . 0 )
196+ (tab-bar-lines . 0 )
199197 (tab-bar-lines-keep-state . 0 )
200- (line-spacing . 0 )
201- (unsplittable . t )
202- (undecorated . t )
203- (top . -1 )
204- (visibility . nil )
205- (mouse-wheel-frame . nil )
206- (no-other-frame . t )
198+ (line-spacing . 0 )
199+ (unsplittable . t )
200+ (undecorated . t )
201+ (top . -1 )
202+ (visibility . nil )
203+ (mouse-wheel-frame . nil )
204+ (no-other-frame . t )
207205 (inhibit-double-buffering . t )
208- (drag-internal-border . t )
209- (no-special-glyphs . t )
210- (desktop-dont-save . t ))
206+ (drag-internal-border . t )
207+ (no-special-glyphs . t )
208+ (desktop-dont-save . t ))
211209 " Frame parameters used to create the frame." )
212210
213211(defvar lsp-ui-doc-render-function nil
@@ -246,8 +244,6 @@ Because some variables are buffer local.")
246244(defvar-local lsp-ui-doc--from-mouse-current nil
247245 " Non nil when the current call is triggered by a mouse event" )
248246
249- (defvar-local lsp-ui-doc--unfocus-frame-timer nil )
250-
251247(defconst lsp-ui-doc--buffer-prefix " *lsp-ui-doc-" )
252248
253249(defmacro lsp-ui-doc--with-buffer (&rest body )
@@ -426,8 +422,8 @@ We don't extract the string that `lps-line' is already displaying."
426422 " Hide the frame."
427423 (setq lsp-ui-doc--bounds nil
428424 lsp-ui-doc--from-mouse nil )
429- (lsp-ui-delete-overlay lsp-ui-doc--inline-ov)
430- (lsp-ui-delete-overlay lsp-ui-doc--highlight-ov)
425+ (lsp-ui-util-safe- delete-overlay lsp-ui-doc--inline-ov)
426+ (lsp-ui-util-safe- delete-overlay lsp-ui-doc--highlight-ov)
431427 (when-let ((frame (lsp-ui-doc--get-frame)))
432428 (when (frame-visible-p frame)
433429 (make-frame-invisible frame))))
@@ -893,15 +889,15 @@ HEIGHT is the documentation number of lines."
893889 (run-hook-with-args 'lsp-ui-doc-frame-hook frame window)
894890 (when lsp-ui-doc-use-webkit
895891 (define-key (current-global-map ) [xwidget-event]
896- (lambda ()
897- (interactive )
898- (let ((xwidget-event-type (nth 1 last-input-event)))
899- ; ; (when (eq xwidget-event-type 'load-changed)
900- ; ; (lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
901- (when (eq xwidget-event-type 'javascript-callback )
902- (let ((proc (nth 3 last-input-event))
903- (arg (nth 4 last-input-event)))
904- (funcall proc arg))))))
892+ (lambda ()
893+ (interactive )
894+ (let ((xwidget-event-type (nth 1 last-input-event)))
895+ ; ; (when (eq xwidget-event-type 'load-changed)
896+ ; ; (lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
897+ (when (eq xwidget-event-type 'javascript-callback )
898+ (let ((proc (nth 3 last-input-event))
899+ (arg (nth 4 last-input-event)))
900+ (funcall proc arg))))))
905901 (lsp-ui-doc--webkit-run-xwidget))
906902 frame))
907903
@@ -924,7 +920,7 @@ HEIGHT is the documentation number of lines."
924920 (and (looking-at " [[:graph:]]" ) (cons (point ) (1+ (point ))))))
925921 (unless (equal lsp-ui-doc--bounds bounds)
926922 (lsp-ui-doc--hide-frame)
927- (lsp-ui-kill-timer lsp-ui-doc--timer)
923+ (lsp-ui-util-safe- kill-timer lsp-ui-doc--timer)
928924 (setq lsp-ui-doc--timer
929925 (run-with-idle-timer
930926 lsp-ui-doc-delay nil
@@ -1171,6 +1167,7 @@ It is supposed to be called from `lsp-ui--toggle'"
11711167 (interactive )
11721168 (lsp-ui-doc--hide-frame))
11731169
1170+ (defvar-local lsp-ui-doc--unfocus-frame-timer nil )
11741171(defun lsp-ui-doc--glance-hide-frame ()
11751172 " Hook to hide hover information popup for `lsp-ui-doc-glance' ."
11761173 (when (or (overlayp lsp-ui-doc--inline-ov)
0 commit comments