]> git.eshelyaron.com Git - emacs.git/commit
Improve treesit settings for typescript/tsx-ts-mode (bug#73404)
authorJuri Linkov <juri@linkov.net>
Wed, 5 Mar 2025 17:44:44 +0000 (19:44 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 07:05:44 +0000 (08:05 +0100)
commita389c5d5b1e2e8fb36892e7ef1e6afadb9cf2a42
tree8ff2fa8e980d32a4a4bef9443b869b8112bd1426
parent1bd33486581981b9ef8d97eaf8c36dde7f58015a
Improve treesit settings for typescript/tsx-ts-mode (bug#73404)

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Add @font-lock-type-face
for 'internal_module' with 'identifier'.
(typescript-ts-mode--defun-type-regexp): New variable with
"internal_module" and "interface_declaration".
(typescript-ts-mode--defun-name): New function that uses
'js--treesit-defun-name' and adds "internal_module" and
"interface_declaration".
(typescript-ts-mode--simple-imenu-settings): New variable
like in 'js-ts-mode' with "Namespace" and "Interface" sections.
(typescript-ts-mode--outline-predicate): New variable.
(typescript-ts-base-mode): Set treesit-defun-type-regexp to
typescript-ts-mode--defun-type-regexp, treesit-defun-name-function
to typescript-ts-mode--defun-name, treesit-simple-imenu-settings
to typescript-ts-mode--simple-imenu-settings,
treesit-outline-predicate to typescript-ts-mode--outline-predicate.
Use js--regexp-opt-symbol for treesit-thing-settings.
(tsx-ts-mode): For 'sentence' thing use the same nodes as
js--treesit-sentence-nodes.  Use js--regexp-opt-symbol for
treesit-thing-settings.

* lisp/progmodes/js.el (js--treesit-sentence-nodes): Add
"jsx_opening_element" and "jsx_closing_element" like in html.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--outline-predicate): Add
outline headings for C++ "namespace_definition" and "class_specifier".

(cherry picked from commit 68def672e61a5b25ec5bdee69493c09d79632ce2)
lisp/progmodes/c-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/typescript-ts-mode.el