]> git.eshelyaron.com Git - emacs.git/commitdiff
Use treesit-sentence-type-regexp in java-ts-mode
authorTheodor Thornhill <theo@thornhill.no>
Sat, 14 Jan 2023 21:41:00 +0000 (22:41 +0100)
committerTheodor Thornhill <theo@thornhill.no>
Sat, 14 Jan 2023 22:06:06 +0000 (23:06 +0100)
Initial support for forward/backward-sentence movement with
tree-sitter.  Include all statements, and some declarations.  Don't
include the bigger declarations we don't want to jump over too big
blocks of code.

* lisp/progmodes/java-ts-mode.el (java-ts-mode): Add relevant node
types to treesit-sentence-type-regexp.

lisp/progmodes/java-ts-mode.el

index 5f4c1275f6602ba909d82edda6bfee80a4a0a8b2..eac052ca4f1143034b339e8be8b3e10486796ed8 100644 (file)
@@ -319,6 +319,14 @@ Return nil if there is no name or if NODE is not a defun node."
                             "module_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")))
+
   ;; Font-lock.
   (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)
   (setq-local treesit-font-lock-feature-list