Skip to content

Commit d0e4faf

Browse files
committed
Remove metals/windowStateDidChange notification.
It was removed from metals.
1 parent 86dfe52 commit d0e4faf

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

lsp-metals.el

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -731,42 +731,12 @@ WORKSPACE is the workspace the notification was received from."
731731
(defvar lsp-metals--current-buffer nil
732732
"Current buffer used to send `metals/didFocusTextDocument' notification.")
733733

734-
(defun lsp-metals--window-state-did-change (focused)
735-
"Send `metals/windowStateDidChange' notification on frames focus change.
736-
FOCUSED if there is a focused frame."
737-
(lsp-notify "metals/windowStateDidChange" `((focused . ,focused))))
738-
739734
(defun lsp-metals--workspaces ()
740735
"Get the list of all metals workspaces."
741736
(--filter
742737
(eq (lsp--client-server-id (lsp--workspace-client it)) 'metals)
743738
(lsp--session-workspaces (lsp-session))))
744739

745-
(defmacro lsp-metals--add-focus-hooks ()
746-
"Add hooks for `metals/windowStateDidChange' notification."
747-
(if (boundp 'after-focus-change-function)
748-
`(progn
749-
(defun lsp-metals--handle-focus-change ()
750-
"Send `metals/windowStateDidChange' notification on frames focus change."
751-
(let ((focused (if (and (fboundp 'frame-focus-state) (frame-focus-state)) t :json-false)))
752-
(--each (lsp-metals--workspaces)
753-
(with-lsp-workspace it
754-
(lsp-metals--window-state-did-change focused)))))
755-
(add-function :after after-focus-change-function 'lsp-metals--handle-focus-change))
756-
`(progn
757-
(defun lsp-metals--focus-in-hook ()
758-
"Send `metals/windowStateDidChange' notification when a frame gains focus."
759-
(--each (lsp-metals--workspaces)
760-
(with-lsp-workspace it
761-
(lsp-metals--window-state-did-change t))))
762-
(add-hook 'focus-in-hook 'lsp-metals--focus-in-hook)
763-
(defun lsp-metals--focus-out-hook ()
764-
"Send `metals/windowStateDidChange' notification when all frames lost focus."
765-
(--each (lsp-metals--workspaces)
766-
(with-lsp-workspace it
767-
(lsp-metals--window-state-did-change :json-false))))
768-
(add-hook 'focus-out-hook 'lsp-metals--focus-out-hook))))
769-
770740
(defun lsp-metals--did-focus ()
771741
"Send `metals/didFocusTextDocument' on buffer switch."
772742
(unless (eq lsp-metals--current-buffer (current-buffer))
@@ -912,7 +882,6 @@ WORKSPACE is the workspace we received notification from."
912882
("metals-run-session-start" (-partial #'lsp-metals--debug-start t)))
913883
:server-id 'metals
914884
:initialized-fn (lambda (workspace)
915-
(lsp-metals--add-focus-hooks)
916885
(with-lsp-workspace workspace
917886
(lsp--set-configuration
918887
(lsp-configuration-section "metals"))))

0 commit comments

Comments
 (0)