diff options
| author | Yuan Fu | 2022-11-20 16:56:33 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-11-20 17:04:58 -0800 |
| commit | 32870d2f207536bb7932beeb2e0ec9a4e0146560 (patch) | |
| tree | 7178d8a11d9b575306118a3fddbcd39e284bb359 /lisp/progmodes/python.el | |
| parent | 625ea08652053617034bf8ceee0d6cfae34f2dcc (diff) | |
| download | emacs-32870d2f207536bb7932beeb2e0ec9a4e0146560.tar.gz 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/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2f967ebab24..c49af223c66 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -5492,7 +5492,8 @@ Similar to `python-imenu-create-index' but use tree-sitter." | |||
| 5492 | (rx (seq bol | 5492 | (rx (seq bol |
| 5493 | (or "function" "class") | 5493 | (or "function" "class") |
| 5494 | "_definition" | 5494 | "_definition" |
| 5495 | eol))))) | 5495 | eol)) |
| 5496 | nil 1000))) | ||
| 5496 | (python--imenu-treesit-create-index-1 tree))) | 5497 | (python--imenu-treesit-create-index-1 tree))) |
| 5497 | 5498 | ||
| 5498 | (defun python-imenu-treesit-create-flat-index () | 5499 | (defun python-imenu-treesit-create-flat-index () |