@@ -1037,16 +1037,17 @@ before, or if the new window is the minibuffer."
1037
1037
(defvar-local lsp-ui-doc--timer-on-changes nil )
1038
1038
1039
1039
(defun lsp-ui-doc--on-state-changed (_frame &optional on-idle )
1040
- (-when-let* ((frame (lsp-ui-doc--get-frame)))
1041
- (and (frame-live-p frame)
1042
- (frame-visible-p frame)
1043
- (not (minibufferp (window-buffer )))
1044
- (or (not (eq (selected-window ) (frame-parameter frame 'lsp-ui-doc--window-origin )))
1045
- (not (eq (window-buffer ) (frame-parameter frame 'lsp-ui-doc--buffer-origin ))))
1046
- (if on-idle (lsp-ui-doc--hide-frame)
1047
- (lsp-ui-util-safe-kill-timer lsp-ui-doc--timer-on-changes)
1048
- (setq lsp-ui-doc--timer-on-changes
1049
- (run-with-idle-timer 0 nil (lambda nil (lsp-ui-doc--on-state-changed frame t ))))))))
1040
+ " On state changed."
1041
+ (when-let* ((frame (lsp-ui-doc--get-frame))
1042
+ ((frame-live-p frame))
1043
+ ((frame-visible-p frame))
1044
+ ((not (minibufferp (window-buffer ))))
1045
+ ((or (not (eq (selected-window ) (frame-parameter frame 'lsp-ui-doc--window-origin )))
1046
+ (not (eq (window-buffer ) (frame-parameter frame 'lsp-ui-doc--buffer-origin ))))))
1047
+ (if on-idle (lsp-ui-doc--hide-frame)
1048
+ (lsp-ui-util-safe-kill-timer lsp-ui-doc--timer-on-changes)
1049
+ (setq lsp-ui-doc--timer-on-changes
1050
+ (run-with-idle-timer 0 nil (lambda nil (lsp-ui-doc--on-state-changed frame t )))))))
1050
1051
1051
1052
(advice-add 'load-theme :before (lambda (&rest _ ) (lsp-ui-doc--delete-frame)))
1052
1053
@@ -1247,7 +1248,6 @@ It is supposed to be called from `lsp-ui--toggle'"
1247
1248
(interactive )
1248
1249
(when-let* ((frame (lsp-ui-doc--get-frame))
1249
1250
(visible (lsp-ui-doc--frame-visible-p)))
1250
- (remove-hook 'post-command-hook 'lsp-ui-doc--unfocus-frame-post-command )
1251
1251
(remove-hook 'post-command-hook 'lsp-ui-doc--hide-frame )
1252
1252
(set-frame-parameter frame 'lsp-ui-doc--no-focus nil )
1253
1253
(set-frame-parameter frame 'cursor-type t )
@@ -1264,14 +1264,8 @@ It is supposed to be called from `lsp-ui--toggle'"
1264
1264
(set-frame-parameter frame 'cursor-type nil )
1265
1265
(lsp-ui-doc--with-buffer
1266
1266
(setq cursor-type nil ))
1267
- (if lsp-ui-doc--from-mouse
1268
- (make-frame-invisible frame)
1269
- (add-hook'post-command-hook 'lsp-ui-doc--unfocus-frame-post-command ))))
1270
-
1271
- (defun lsp-ui-doc--unfocus-frame-post-command ()
1272
- " Hide frame on the next post command after unfocus frame."
1273
- (add-hook 'post-command-hook 'lsp-ui-doc--hide-frame )
1274
- (remove-hook 'post-command-hook 'lsp-ui-doc--unfocus-frame-post-command ))
1267
+ (when lsp-ui-doc--from-mouse
1268
+ (make-frame-invisible frame))))
1275
1269
1276
1270
(provide 'lsp-ui-doc )
1277
1271
; ;; lsp-ui-doc.el ends here
0 commit comments