- eglot 启动jdtls已经成功,并配置了server端debug
(add-to-list 'eglot-server-programs
'((java-mode java-ts-mode) .
("jdtls"
:initializationOptions
(:bundles ["/PATH/TO/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-VERSION.jar"]))))
dape配置如下
(use-package dape
:vc (:fetcher "github" :repo "svaante/dape")
:ensure t
:bind
("C-c d d". dape)
("C-c d b" . dape-breakpoint-toggle)
("C-c d c" . dape-continue)
("C-c d n" . dape-next)
("C-c d s" . dape-step-in)
("C-c d o" . dape-step-out)
("C-c d k" . dape-kill)
("C-c d v" . dape-variables)
("C-c d t" . dape-stack)
:config
(setq jdtls-install-dir "D:/xxxx/resources/installed/.cache/jdtls/")
;; 修复 dape 适配器配置
(setq dape-adapters
;;`((java-adapter
;; :type "java"
;; :command "java"
;; :cwd ,(expand-file-name "~/.emacs.d/")
;; :args ["-jar",(car (file-expand-wildcards
;; (concat jdtls-install-dir "plugins/org.eclipse.equinox.launcher_*.jar")))
;; "-configuration",(concat jdtls-install-dir
;; (pcase system-type
;; ('windows-nt "config_win")
;; ('darwin "config_mac")
;; (_ "config_linux")))])))
;; 修复 dape 配置模板
(setq dape-configs
`(("Tomcat Debug"
;;:adapter "java-adapter"
:type "java"
:request "attach"
:host "localhost"
:port 1099
:project-name "asp"
:classpath [,(expand-file-name "web/WEB-INF/classes" (project-root (project-current)))]
:source-path [,(expand-file-name "src" (project-root (project-current)))])
("Remote Tomcat"
;;:adapter "java-adapter"
:type "java"
:request "attach"
:host "127.0.0.1"
:port 11034
:project-name "remote-app"
:classpath ["/path/to/remote-app/target/classes"]
:source-path ["/path/to/remote-app/src/main/java"]))))
执行 dape + Ret时提示找不到配置