1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Adapt recent css-ts-mode changes to mhtml-ts-mode

* lisp/textmodes/css-mode.el (css--treesit-thing-settings):
(css-ts-mode--outline-predicate): New variables.
(css-ts-mode): Set treesit-outline-predicate.

* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--treesit-thing-settings):
Use css--treesit-thing-settings and css--treesit-defun-type-regexp.
(mhtml-ts-mode): Use 'css-ts-mode--outline-predicate' for
'treesit-aggregated-outline-predicate'.
This commit is contained in:
Juri Linkov 2025-03-02 20:44:40 +02:00
parent a5e82110b0
commit 888a2b5394
2 changed files with 37 additions and 30 deletions

View file

@ -313,8 +313,9 @@ NODE and PARENT are ignored."
(car js--treesit-thing-settings)
`((defun ,js--treesit-defun-type-regexp)))
;; CSS thing settings
`(css
(defun ,(regexp-opt (list css--treesit-defun-type-regexp)))))
(append
(car css--treesit-thing-settings)
`((defun ,css--treesit-defun-type-regexp))))
"Settings for `treesit-thing-settings'.")
;; We use a function instead of a variable, because
@ -585,7 +586,7 @@ Powered by tree-sitter."
`((html . ,#'html-ts-mode--outline-predicate)
;; TODO: add a predicate like for html above
(javascript . "\\`function_declaration\\'")
(css . "\\`rule_set\\'")))
(css . ,css-ts-mode--outline-predicate)))
(treesit-major-mode-setup)