lang/java: refactor commands out into autoloads
This commit is contained in:
parent
b74abebffa
commit
d1b3021304
3 changed files with 27 additions and 23 deletions
|
@ -5,30 +5,14 @@
|
|||
:after lsp-clients
|
||||
:preface
|
||||
(setq lsp-java-workspace-dir (concat doom-etc-dir "java-workspace"))
|
||||
(add-hook! java-mode-local-vars #'lsp!)
|
||||
(add-hook 'java-mode-local-vars-hook #'lsp!)
|
||||
(when (featurep! :tools debugger +lsp)
|
||||
(defun +java/run-test ()
|
||||
"Runs test at point. If in a method, runs the test method, otherwise runs the entire test class."
|
||||
(interactive)
|
||||
(condition-case nil
|
||||
(dap-java-run-test-method)
|
||||
(user-error (dap-java-run-test-class))))
|
||||
|
||||
(defun +java/debug-test ()
|
||||
"Runs test at point in a debugger. If in a method, runs the test method, otherwise runs the entire test class."
|
||||
(interactive)
|
||||
(condition-case nil
|
||||
(call-interactively #'dap-java-debug-test-method)
|
||||
(user-error (call-interactively #'dap-java-debug-test-class))))
|
||||
|
||||
(setq lsp-jt-root (concat lsp-java-server-install-dir "java-test/server/")
|
||||
dap-java-test-runner (concat lsp-java-server-install-dir "test-runner/junit-platform-console-standalone.jar"))
|
||||
(map! :map java-mode-map
|
||||
:localleader
|
||||
(:prefix ("t" . "Test")
|
||||
:desc "Run test class or method" "t" #'+java/run-test
|
||||
:desc "Run all tests in class" "a" #'dap-java-run-test-class
|
||||
:desc "Run test class or method" "t" #'+java/run-test
|
||||
:desc "Run all tests in class" "a" #'dap-java-run-test-class
|
||||
:desc "Debug test class or method" "d" #'+java/debug-test
|
||||
:desc "Debug all tests in class" "D" #'dap-java-debug-test-class)))
|
||||
:init
|
||||
(when (featurep! :tools debugger +lsp)
|
||||
(setq lsp-jt-root (concat lsp-java-server-install-dir "java-test/server/")
|
||||
dap-java-test-runner (concat lsp-java-server-install-dir "test-runner/junit-platform-console-standalone.jar"))))
|
||||
:desc "Debug all tests in class" "D" #'dap-java-debug-test-class))))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; lang/java/config.el -*- lexical-binding: t; -*-
|
||||
;;; lang/java/autoload/java.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; yasnippet defuns
|
||||
;;;###autoload
|
20
modules/lang/java/autoload/lsp.el
Normal file
20
modules/lang/java/autoload/lsp.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
;;; lang/java/autoload/lsp.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :tools debugger +lsp)
|
||||
|
||||
;;;###autoload
|
||||
(defun +java/run-test ()
|
||||
"Runs test at point.
|
||||
If in a method, runs the test method, otherwise runs the entire test class."
|
||||
(interactive)
|
||||
(condition-case nil
|
||||
(dap-java-run-test-method)
|
||||
(user-error (dap-java-run-test-class))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +java/debug-test ()
|
||||
"Runs test at point in a debugger.
|
||||
If in a method, runs the test method, otherwise runs the entire test class."
|
||||
(interactive)
|
||||
(condition-case nil
|
||||
(call-interactively #'dap-java-debug-test-method)
|
||||
(user-error (call-interactively #'dap-java-debug-test-class))))
|
Loading…
Add table
Add a link
Reference in a new issue