diff options
author | Yuan Fu <casouri@gmail.com> | 2022-12-15 17:25:06 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-12-15 17:29:44 -0800 |
commit | 037407ad95a55df900bd508ca3c44499735d7c2a (patch) | |
tree | 9359c3a229e5905a4e1e8512c54f5beae66d7f90 /lisp/progmodes/python.el | |
parent | fee2efe1b035d601ac53a32801227402e9be8bca (diff) | |
download | emacs-037407ad95a55df900bd508ca3c44499735d7c2a.tar.gz emacs-037407ad95a55df900bd508ca3c44499735d7c2a.tar.bz2 emacs-037407ad95a55df900bd508ca3c44499735d7c2a.zip |
Add "function" feature to python-ts-mode (bug#59977)
* lisp/progmodes/python.el (python--treesit-settings): Add feature.
(python-ts-mode): Add feature. And fix indentation for the
python-indent-guess-indent-offset code.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a10359b384a..bdc9e6fa78c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1095,6 +1095,14 @@ fontified." (class_definition name: (identifier) @font-lock-type-face)) + :feature 'function + :language 'python + '((function_definition + name: (identifier) @font-lock-function-name-face) + (call function: (identifier) @font-lock-function-name-face) + (call function: (attribute + attribute: (identifier) @font-lock-function-name-face))) + :feature 'keyword :language 'python `([,@python--treesit-keywords] @font-lock-keyword-face @@ -6629,7 +6637,7 @@ implementations: `python-mode' and `python-ts-mode'." ( keyword string type) ( assignment builtin constant decorator escape-sequence number property string-interpolation ) - ( bracket delimiter operator))) + ( function bracket delimiter operator))) (setq-local treesit-font-lock-settings python--treesit-settings) (setq-local imenu-create-index-function #'python-imenu-treesit-create-index) @@ -6637,8 +6645,8 @@ implementations: `python-mode' and `python-ts-mode'." "_definition")) (treesit-major-mode-setup) - (when python-indent-guess-indent-offset - (python-indent-guess-indent-offset)))) + (when python-indent-guess-indent-offset + (python-indent-guess-indent-offset)))) ;;; Completion predicates for M-x ;; Commands that only make sense when editing Python code |