From 344ab6b68670df4ed81c249b846594850dbf8653 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 20 Apr 2022 15:53:36 -0400 Subject: [PATCH] Configure dap-mode debugging for Java --- emacs/.emacs.d/config/init-ide.el | 7 +++++++ emacs/.emacs.d/config/init-java.el | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/emacs/.emacs.d/config/init-ide.el b/emacs/.emacs.d/config/init-ide.el index fc4dc58..4d4c18e 100644 --- a/emacs/.emacs.d/config/init-ide.el +++ b/emacs/.emacs.d/config/init-ide.el @@ -62,6 +62,13 @@ :custom (lsp-ui-doc-show-with-cursor t)) +;; Integrated debugger +(use-package dap-mode + :commands (dap-debug dap-debug-edit-template dap-mode) + :config + (add-hook 'dap-stopped-hook + (lambda (arg) (call-interactively #'dap-hydra)))) + ;; Some compilation-mode conveniences (use-package compile :straight (:type built-in) diff --git a/emacs/.emacs.d/config/init-java.el b/emacs/.emacs.d/config/init-java.el index 67db94c..cc8642d 100644 --- a/emacs/.emacs.d/config/init-java.el +++ b/emacs/.emacs.d/config/init-java.el @@ -7,6 +7,23 @@ (use-package lsp-java :hook (java-mode . lsp-deferred)) +(defvar java-debug-map (make-sparse-keymap)) +(general-def java-mode-map + "C-c d" '(:keymap java-debug-map :which-key "debug")) +(general-def java-debug-map + "d" 'dap-java-debug + "t" 'dap-java-debug-test-method + "c" 'dap-java-debug-test-class) + +(with-eval-after-load 'dap-java + (setq dap-java-test-additional-args '("-n" "\".*(Test|IT).*\""))) + +(defun jdormit-java-setup () + (require 'dap-java) + (dap-mode)) + +(add-hook 'java-mode-hook 'jdormit-java-setup) + (use-package protobuf-mode) (provide 'init-java)