Skip to content

Commit e6fa410

Browse files
committed
Lenses integration
1 parent 7a93003 commit e6fa410

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lsp-java.el

+18-6
Original file line numberDiff line numberDiff line change
@@ -836,19 +836,31 @@ PROJECT-URI uri of the item."
836836
(goto-char (point-min)))
837837
(user-error "Failed to calculate project for buffer %s" (buffer-name))))))
838838

839+
(cl-defmethod lsp-execute-command
840+
((_server (eql jdtls)) (command (eql java.show.references)) params)
841+
(if-let (refs (third params))
842+
(xref--show-xrefs (lsp--locations-to-xref-items refs) nil)
843+
(user-error "No references")))
844+
845+
(cl-defmethod lsp-execute-command
846+
((_server (eql jdtls)) (command (eql java.show.implementations)) params)
847+
(if-let (refs (third params))
848+
(xref--show-xrefs (lsp--locations-to-xref-items refs) nil)
849+
(user-error "No implementations")))
850+
839851
(lsp-register-client
840852
(make-lsp--client
841853
:new-connection (lsp-stdio-connection 'lsp-java--ls-command)
842854
:major-modes '(java-mode)
843855
:server-id 'jdtls
844856
:multi-root t
845-
:notification-handlers (lsp-ht ("language/status" 'lsp-java--language-status-callback)
846-
("language/actionableNotification" 'lsp-java--actionable-notification-callback)
847-
("language/progressReport" 'lsp-java--progress-report)
848-
("workspace/notify" 'lsp-java--workspace-notify))
857+
:notification-handlers (lsp-ht ("language/status" #'lsp-java--language-status-callback)
858+
("language/actionableNotification" #'lsp-java--actionable-notification-callback)
859+
("language/progressReport" #'lsp-java--progress-report)
860+
("workspace/notify" #'lsp-java--workspace-notify))
849861

850862
:request-handlers (lsp-ht ("workspace/executeClientCommand" 'lsp-java--boot-workspace-execute-client-command))
851-
:action-handlers (lsp-ht ("java.apply.workspaceEdit" 'lsp-java--apply-workspace-edit))
863+
:action-handlers (lsp-ht ("java.apply.workspaceEdit" #'lsp-java--apply-workspace-edit))
852864
:uri-handlers (lsp-ht ("jdt" 'lsp-java--resolve-uri)
853865
("chelib" 'lsp-java--resolve-uri))
854866
:initialization-options (lambda ()
@@ -868,7 +880,7 @@ PROJECT-URI uri of the item."
868880
(lsp-java-update-project-uris)))))
869881

870882
(defun lsp-java-spring-initializr ()
871-
"Emacs frontend for https://start.spring.io/ ."
883+
"Emacs frontend for https://start.spring.io/."
872884
(interactive)
873885
(let ((base-url "https://start.spring.io/"))
874886
(message "Requesting spring initializr data...")

0 commit comments

Comments
 (0)