diff options
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index eab5e70af33..8220e3086fd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1106,24 +1106,25 @@ fontified." :language 'python '((interpolation) @python--treesit-fontify-string-interpolation) + :feature 'keyword + :language 'python + `([,@python--treesit-keywords] @font-lock-keyword-face + ((identifier) @font-lock-keyword-face + (:match "^self$" @font-lock-keyword-face))) + :feature 'definition :language 'python '((function_definition name: (identifier) @font-lock-function-name-face) (class_definition - name: (identifier) @font-lock-type-face)) + name: (identifier) @font-lock-type-face) + (parameters (identifier) @font-lock-variable-name-face)) :feature 'function :language 'python - '((call function: (identifier) @font-lock-function-name-face) + '((call function: (identifier) @font-lock-function-call-face) (call function: (attribute - attribute: (identifier) @font-lock-function-name-face))) - - :feature 'keyword - :language 'python - `([,@python--treesit-keywords] @font-lock-keyword-face - ((identifier) @font-lock-keyword-face - (:match "^self$" @font-lock-keyword-face))) + attribute: (identifier) @font-lock-function-call-face))) :feature 'builtin :language 'python @@ -1146,7 +1147,7 @@ fontified." @font-lock-variable-name-face) (assignment left: (attribute attribute: (identifier) - @font-lock-property-face)) + @font-lock-property-ref-face)) (pattern_list (identifier) @font-lock-variable-name-face) (tuple_pattern (identifier) @@ -1183,12 +1184,12 @@ fontified." :feature 'property :language 'python '((attribute - attribute: (identifier) @font-lock-property-face) + attribute: (identifier) @font-lock-property-ref-face) (class_definition body: (block (expression_statement (assignment left: - (identifier) @font-lock-property-face))))) + (identifier) @font-lock-property-ref-face))))) :feature 'operator :language 'python @@ -1211,10 +1212,10 @@ fontified." "Check whether NODE is a variable. NODE's type should be \"identifier\"." ;; An identifier can be a function/class name, a property, or a - ;; variables. This function filters out function/class names and - ;; properties. + ;; variables. This function filters out function/class names, + ;; properties and method parameters. (pcase (treesit-node-type (treesit-node-parent node)) - ((or "function_definition" "class_definition") nil) + ((or "function_definition" "class_definition" "parameters") nil) ("attribute" (pcase (treesit-node-field-name node) ("object" t) |