]> git.eshelyaron.com Git - emacs.git/commitdiff
Add tree-sitter navigation support to python-mode
authorYuan Fu <casouri@gmail.com>
Wed, 26 Oct 2022 22:38:40 +0000 (15:38 -0700)
committerYuan Fu <casouri@gmail.com>
Wed, 26 Oct 2022 22:39:02 +0000 (15:39 -0700)
* lisp/progmodes/python.el (python-mode): Set
treesit-defun-type-regexp.

lisp/progmodes/python.el

index 2c0c35174c2621c58d2acdeef319368b00140c47..9783936635010e7de67069304a875eee57aebaab 100644 (file)
@@ -6473,6 +6473,10 @@ Add import for undefined name `%s' (empty to skip): "
     (setq-local treesit-font-lock-settings python--treesit-settings)
     (setq-local imenu-create-index-function
                 #'python-imenu-treesit-create-index)
+    (setq-local treesit-defun-type-regexp (rx bol
+                                              (or "function" "class")
+                                              "_definition"
+                                              eol))
     (treesit-major-mode-setup))
    ;; Elisp.
    (t