summaryrefslogtreecommitdiff
path: root/lisp/textmodes/css-mode.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-11-20 16:56:33 -0800
committerYuan Fu <casouri@gmail.com>2022-11-20 17:04:58 -0800
commit32870d2f207536bb7932beeb2e0ec9a4e0146560 (patch)
tree7178d8a11d9b575306118a3fddbcd39e284bb359 /lisp/textmodes/css-mode.el
parent625ea08652053617034bf8ceee0d6cfae34f2dcc (diff)
downloademacs-32870d2f207536bb7932beeb2e0ec9a4e0146560.tar.gz
emacs-32870d2f207536bb7932beeb2e0ec9a4e0146560.tar.bz2
emacs-32870d2f207536bb7932beeb2e0ec9a4e0146560.zip
Limit recursion level for tree-sitter imenu functions
Generating imenu index doesn't require going down to the bottom of the tree (defun's are usually top-level). Add limit so we don't go too far down on very large buffers. * lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu) * lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu) * lisp/progmodes/js.el (js--treesit-imenu) * lisp/progmodes/json-ts-mode.el (json-ts-mode--imenu) * lisp/progmodes/python.el (python-imenu-treesit-create-index) * lisp/textmodes/css-mode.el (css--treesit-imenu): Add limit to treesit-induce-sparse-tree.
Diffstat (limited to 'lisp/textmodes/css-mode.el')
-rw-r--r--lisp/textmodes/css-mode.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 6915e499bba..97272cb7147 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1406,7 +1406,8 @@ the subtrees."
"Return Imenu alist for the current buffer."
(let* ((node (treesit-buffer-root-node))
(tree (treesit-induce-sparse-tree
- node (rx (or "rule_set" "media_statement")))))
+ node (rx (or "rule_set" "media_statement"))
+ nil 1000)))
(css--treesit-imenu-1 tree)))
;;; Completion