emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 05740f05b7: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master 05740f05b7: Merge from origin/emacs-29
Date: Wed, 21 Dec 2022 00:45:40 -0500 (EST)

branch: master
commit 05740f05b732a5df473bdf9d1750e97f6a86f2c0
Merge: e871f21348 12b2b8864c
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    12b2b8864c2 Fix empty pairs in js tree-sitter imenu alist (bug#59945)
    6d9f367ead3 ; * lisp/treesit.el (treesit-simple-indent-presets): Fix ...
---
 lisp/progmodes/js.el | 11 ++++++++---
 lisp/treesit.el      |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index cbcca81baa..15272dcc00 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3738,9 +3738,14 @@ definition*\"."
                      node "function_declaration" nil 1000))
          (var-tree (treesit-induce-sparse-tree
                     node "lexical_declaration" nil 1000)))
-    `(("Class" . ,(js--treesit-imenu-1 class-tree))
-      ("Variable" . ,(js--treesit-imenu-1 var-tree))
-      ("Function" . ,(js--treesit-imenu-1 func-tree)))))
+    ;; When a sub-tree is empty, we should not return that pair at all.
+    (append
+     (and func-tree
+          `(("Function" . ,(js--treesit-imenu-1 func-tree))))
+     (and var-tree
+          `(("Variable" . ,(js--treesit-imenu-1 var-tree))))
+     (and class-tree
+          `(("Class" . ,(js--treesit-imenu-1 class-tree)))))))
 
 ;;; Main Function
 
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 1f366807ce..04019cae60 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1183,7 +1183,7 @@ no-node
 
 \(n-p-gp NODE-TYPE PARENT-TYPE GRANDPARENT-TYPE)
 
-    Checks that NODE, its parent, and its grandparent's type.
+    Checks for NODE's, its parent's, and its grandparent's type.
 
 \(query QUERY)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]