From aa6b26cf3783e8c84d1158704807711a3b719d48 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Mon, 22 Jan 2024 14:46:58 +0900 Subject: [PATCH 1/2] Fix php-ts-mode--defun-name --- php-ts-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php-ts-mode.el b/php-ts-mode.el index c44e82a..cddfda0 100644 --- a/php-ts-mode.el +++ b/php-ts-mode.el @@ -232,15 +232,17 @@ see https://www.php.net/manual/language.constants.predefined.php") `((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)) "Tree-sitter font-lock settings for `php-ts-mode'.") - (defun php-ts-mode--defun-name (node) +(defun php-ts-mode--defun-name (node) "Return the defun name of NODE. Return nil if there is no name or if NODE is not a defun node." (pcase (treesit-node-type node) ((or "class_declaration" "enum_declaration" + "function_definition" "interface_declaration" "method_declaration" - "namespace_definition") + "namespace_definition" + "trait_declaration") (treesit-node-text (treesit-node-child-by-field-name node "name") t)))) From 113398904317cfa046b753dc903ab288dfaa2367 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Mon, 22 Jan 2024 14:47:13 +0900 Subject: [PATCH 2/2] Add trait_declaration to treesit-simple-imenu-settings --- php-ts-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/php-ts-mode.el b/php-ts-mode.el index cddfda0..bfd9074 100644 --- a/php-ts-mode.el +++ b/php-ts-mode.el @@ -316,6 +316,7 @@ Currently there are `php-mode' and `php-ts-mode'." ("Enum" "\\`enum_declaration\\'" nil nil) ("Class" "\\`class_declaration\\'" nil nil) ("Interface" "\\`interface_declaration\\'" nil nil) + ("Trait" "\\`trait_declaration\\'" nil nil) ("Method" "\\`method_declaration\\'" nil nil))) (treesit-major-mode-setup))