summaryrefslogtreecommitdiff
path: root/lisp/progmodes/java-ts-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/java-ts-mode.el')
-rw-r--r--lisp/progmodes/java-ts-mode.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index fca00cdce4f..47d87112ffb 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -314,6 +314,11 @@ Return nil if there is no name or if NODE is not a defun node."
;; Comments.
(c-ts-common-comment-setup)
+ (setq-local treesit-text-type-regexp
+ (regexp-opt '("line_comment"
+ "block_comment"
+ "text_block")))
+
;; Indent.
(setq-local c-ts-common-indent-type-regexp-alist
`((block . ,(rx (or "class_body"
@@ -352,6 +357,29 @@ Return nil if there is no name or if NODE is not a defun node."
"constructor_declaration")))
(setq-local treesit-defun-name-function #'java-ts-mode--defun-name)
+ (setq-local treesit-sentence-type-regexp
+ (regexp-opt '("statement"
+ "local_variable_declaration"
+ "field_declaration"
+ "module_declaration"
+ "package_declaration"
+ "import_declaration")))
+
+ (setq-local treesit-sexp-type-regexp
+ (regexp-opt '("annotation"
+ "parenthesized_expression"
+ "argument_list"
+ "identifier"
+ "modifiers"
+ "block"
+ "body"
+ "literal"
+ "access"
+ "reference"
+ "_type"
+ "true"
+ "false")))
+
;; Font-lock.
(setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list