From: Jostein Kjønigsen Date: Thu, 20 Mar 2025 09:39:31 +0000 (+0100) Subject: python-ts-mode: Improve fontification X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fd37e5f28a28e01111c6dd1253dbb9b19286a8e9;p=emacs.git python-ts-mode: Improve fontification python--treesit-settings: Fontification based on selectors & code-conventions - Constructor: Fontified as type, not function-call. - Typed default parameters - Fontify kwargs in function calls as property-use. Differentiate from variable-use (passed in arguments) (cherry picked from commit 39721a4d79a6056e09f4d0996f1942eee8e34934) --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 664c00243a9..d041d1713ef 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1231,6 +1231,7 @@ fontified." (parameters (identifier) @font-lock-variable-name-face) (parameters (typed_parameter (identifier) @font-lock-variable-name-face)) (parameters (default_parameter name: (identifier) @font-lock-variable-name-face)) + (parameters (typed_default_parameter name: (identifier) @font-lock-variable-name-face)) (lambda_parameters (identifier) @font-lock-variable-name-face) (for_in_clause left: (identifier) @font-lock-variable-name-face) @@ -1261,7 +1262,11 @@ fontified." :feature 'function :language 'python - '((call function: (identifier) @font-lock-function-call-face) + '(((call function: (identifier) @font-lock-type-face) + (:match "\\`[A-Z][A-Za-z0-9]+\\'" @font-lock-type-face)) + (call function: (identifier) @font-lock-function-call-face) + (call arguments: (argument_list (keyword_argument + name: (identifier) @font-lock-property-name-face))) (call function: (attribute attribute: (identifier) @font-lock-function-call-face)))