Skip to content

Commit ca5596e

Browse files
committed
Revert 'Hide doc frame on next post comman'
1 parent fbaf47e commit ca5596e

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

lsp-ui-doc.el

+13-19
Original file line numberDiff line numberDiff line change
@@ -1037,16 +1037,17 @@ before, or if the new window is the minibuffer."
10371037
(defvar-local lsp-ui-doc--timer-on-changes nil)
10381038

10391039
(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)))))))
10501051

10511052
(advice-add 'load-theme :before (lambda (&rest _) (lsp-ui-doc--delete-frame)))
10521053

@@ -1247,7 +1248,6 @@ It is supposed to be called from `lsp-ui--toggle'"
12471248
(interactive)
12481249
(when-let* ((frame (lsp-ui-doc--get-frame))
12491250
(visible (lsp-ui-doc--frame-visible-p)))
1250-
(remove-hook 'post-command-hook 'lsp-ui-doc--unfocus-frame-post-command)
12511251
(remove-hook 'post-command-hook 'lsp-ui-doc--hide-frame)
12521252
(set-frame-parameter frame 'lsp-ui-doc--no-focus nil)
12531253
(set-frame-parameter frame 'cursor-type t)
@@ -1264,14 +1264,8 @@ It is supposed to be called from `lsp-ui--toggle'"
12641264
(set-frame-parameter frame 'cursor-type nil)
12651265
(lsp-ui-doc--with-buffer
12661266
(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))))
12751269

12761270
(provide 'lsp-ui-doc)
12771271
;;; lsp-ui-doc.el ends here

0 commit comments

Comments
 (0)