@@ -731,42 +731,12 @@ WORKSPACE is the workspace the notification was received from."
731
731
(defvar lsp-metals--current-buffer nil
732
732
" Current buffer used to send `metals/didFocusTextDocument' notification." )
733
733
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
-
739
734
(defun lsp-metals--workspaces ()
740
735
" Get the list of all metals workspaces."
741
736
(--filter
742
737
(eq (lsp--client-server-id (lsp--workspace-client it)) 'metals )
743
738
(lsp--session-workspaces (lsp-session))))
744
739
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
-
770
740
(defun lsp-metals--did-focus ()
771
741
" Send `metals/didFocusTextDocument' on buffer switch."
772
742
(unless (eq lsp-metals--current-buffer (current-buffer ))
@@ -912,7 +882,6 @@ WORKSPACE is the workspace we received notification from."
912
882
(" metals-run-session-start" (-partial #'lsp-metals--debug-start t )))
913
883
:server-id 'metals
914
884
:initialized-fn (lambda (workspace )
915
- (lsp-metals--add-focus-hooks)
916
885
(with-lsp-workspace workspace
917
886
(lsp--set-configuration
918
887
(lsp-configuration-section " metals" ))))
0 commit comments