dotfiles/emacs/.emacs.d/config/init-java.el

38 lines
1.2 KiB
EmacsLisp

;; -*- lexical-binding: t; -*-
;; Default to the Google styleguide formatting for Java
(use-package google-c-style
:hook (java-mode . google-set-c-style))
(use-package lsp-java
:custom
(lsp-java-maven-download-sources t)
(lsp-java-configuration-runtimes '[(:name "JavaSE-11"
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk"
:default t)
(:name "JavaSE-17"
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk")]))
(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
"b" 'dap-breakpoint-toggle)
(with-eval-after-load 'dap-java
(setq dap-java-test-additional-args '("-n" "\".*(Test|IT).*\"")))
(defun jdormit-java-setup ()
(lsp-deferred)
(require 'dap-java)
(dap-mode))
(add-hook 'java-mode-hook 'jdormit-java-setup)
(use-package protobuf-mode)
(provide 'init-java)