1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Improve hideshow support for elixir-ts-mode and heex-ts-mode

* lisp/progmodes/elixir-ts-mode.el (elixir-ts--thing-settings):
Add 'defun' thing.
(elixir-ts-mode): Set 'hs-treesit-things'.
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode):
Set 'hs-treesit-things'.  Use bos/eos instead of bol/eol.
This commit is contained in:
Juri Linkov 2025-11-10 20:46:40 +02:00
parent 4358838a3b
commit d059e7516e
2 changed files with 7 additions and 4 deletions

View file

@ -591,7 +591,8 @@
"Tree-sitter font-lock feature list.")
(defvar elixir-ts--thing-settings
`((sexp (not (or (and named
`((defun ,(rx bos "call" eos))
(sexp (not (or (and named
,(rx bos (or "source" "keywords" "comment")
eos))
(and anonymous
@ -798,7 +799,8 @@ Return nil if NODE is not a defun node or doesn't have a name."
treesit-sexp-thing 'sexp
;; But still use 'list' for `down-list' and `up-list'
treesit-sexp-thing-down-list 'list
treesit-sexp-thing-up-list 'list)))
treesit-sexp-thing-up-list 'list
hs-treesit-things '(or defun sexp))))
(derived-mode-add-parents 'elixir-ts-mode '(elixir-mode))

View file

@ -209,7 +209,7 @@ Return nil if NODE is not a defun node or doesn't have a name."
;; Navigation.
(setq-local treesit-defun-type-regexp
(rx bol (or "component" "tag" "slot") eol))
(rx bos (or "component" "tag" "slot") eos))
(setq-local treesit-defun-name-function #'heex-ts--defun-name)
;; Imenu
@ -261,7 +261,8 @@ Return nil if NODE is not a defun node or doesn't have a name."
;; Enable the 'sexp' navigation by default
(setq-local forward-sexp-function #'treesit-forward-sexp
treesit-sexp-thing 'sexp)))
treesit-sexp-thing 'sexp
hs-treesit-things 'list)))
(derived-mode-add-parents 'heex-ts-mode '(heex-mode))