feat(java): add treesit support

This commit is contained in:
Henrik Lissner
2025-08-27 17:26:25 +02:00
parent 6ca155ea11
commit 07e7c699cf
2 changed files with 12 additions and 3 deletions

View File

@@ -30,13 +30,18 @@ If the depth is 2, the first two directories are removed: net.lissner.game.")
(modulep! :tools lsp -eglot)) (modulep! :tools lsp -eglot))
(load! "+lsp")) (load! "+lsp"))
(when (modulep! +tree-sitter)
(add-hook 'java-mode-local-vars-hook #'tree-sitter! 'append))
;; ;;
;;; Common packages ;;; 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 (use-package! android-mode
:commands android-mode :commands android-mode
:init :init

View File

@@ -9,6 +9,10 @@
(modulep! :tools tree-sitter)) (modulep! :tools tree-sitter))
"This module requires (: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") (unless (executable-find "javac")
(warn! "Couldn't find the javac executable, are you sure the JDK is installed?")) (warn! "Couldn't find the javac executable, are you sure the JDK is installed?"))