diff --git a/modules/lang/java/config.el b/modules/lang/java/config.el index 12eb46377..1dab9a892 100644 --- a/modules/lang/java/config.el +++ b/modules/lang/java/config.el @@ -30,13 +30,18 @@ If the depth is 2, the first two directories are removed: net.lissner.game.") (modulep! :tools lsp -eglot)) (load! "+lsp")) -(when (modulep! +tree-sitter) - (add-hook 'java-mode-local-vars-hook #'tree-sitter! 'append)) - ;; ;;; Common packages +(use-package! java-ts-mode + :when (modulep! +tree-sitter) + :when (fboundp 'java-ts-mode) ; 29.1+ only + :defer t + :init + (set-tree-sitter! 'java-mode 'java-ts-mode '(java doxygen))) + + (use-package! android-mode :commands android-mode :init diff --git a/modules/lang/java/doctor.el b/modules/lang/java/doctor.el index 9e0a9a1aa..102ec263e 100644 --- a/modules/lang/java/doctor.el +++ b/modules/lang/java/doctor.el @@ -9,6 +9,10 @@ (modulep! :tools tree-sitter)) "This module requires (:tools tree-sitter)") +(assert! (or (not (modulep! +tree-sitter)) + (fboundp 'java-ts-mode)) + "Can't find `java-ts-mode'; Emacs 29.1+ is required") + (unless (executable-find "javac") (warn! "Couldn't find the javac executable, are you sure the JDK is installed?"))