Skip to content

Commit f02398b

Browse files
committed
Use lsp-protocol.el
1 parent b0e1909 commit f02398b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

dap-java.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ If the port is taken, DAP will try the next port."
8989
:group 'dap-java
9090
:type 'number)
9191

92+
(eval-and-compile
93+
(lsp-interface
94+
(java:MainClass (:mainClass :projectName))))
95+
9296
(defun dap-java-test-class ()
9397
"Get class FDQN."
9498
(-if-let* ((symbols (lsp--get-document-symbols))
@@ -130,23 +134,22 @@ If the port is taken, DAP will try the next port."
130134
((= main-classes-count 0) (error "Unable to find main class.
131135
Please check whether the server is configured propertly"))
132136
((= main-classes-count 1) (cl-first main-classes))
133-
((setq current-class (--first (string= buffer-file-name (gethash "filePath" it))
137+
((setq current-class (--first (string= buffer-file-name (lsp-get it :filePath))
134138
main-classes))
135139
current-class)
136140
(t (dap--completing-read "Select main class to run: "
137141
main-classes
138142
(lambda (it)
139143
(format "%s(%s)"
140-
(gethash "mainClass" it)
141-
(gethash "projectName" it)))
144+
(lsp-get it :mainClass)
145+
(lsp-get it :projectName)))
142146
nil
143147
t)))))
144-
145148
(defun dap-java--populate-launch-args (conf)
146149
"Populate CONF with launch related configurations."
147150
(when (not (and (plist-get conf :mainClass)
148151
(plist-get conf :projectName)))
149-
(-let [(&hash "mainClass" main-class "projectName" project-name) (dap-java--select-main-class)]
152+
(-let [(&java:MainClass :main-class :project-name) (dap-java--select-main-class)]
150153
(setq conf (plist-put conf :mainClass main-class))
151154
(plist-put conf :projectName project-name)))
152155

0 commit comments

Comments
 (0)