From afd0b548fcc5e141528a442ff9100fe8e2b98f21 Mon Sep 17 00:00:00 2001 From: Prateek Sharma Date: Sat, 20 Apr 2024 02:06:17 +0530 Subject: [PATCH] Fix python-ts-mode built-in functions and attributes (bug#70478) * lisp/progmodes/python.el (python--treesit-settings): Change the treesitter query to fetch the correct type of node for built-in functions and attributes and highlight them with corresponding font-lock face. --- lisp/progmodes/python.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9849fde8588..02588d756e9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1187,13 +1187,15 @@ fontified." :feature 'builtin :language 'python - `(((identifier) @font-lock-builtin-face - (:match ,(rx-to-string - `(seq bol - (or ,@python--treesit-builtins - ,@python--treesit-special-attributes) - eol)) - @font-lock-builtin-face))) + `((call function: (identifier) @font-lock-builtin-face + (:match ,(rx-to-string + `(seq bol (or ,@python--treesit-builtins) eol)) + @font-lock-builtin-face)) + (attribute attribute: (identifier) @font-lock-builtin-face + (:match ,(rx-to-string + `(seq bol + (or ,@python--treesit-special-attributes) eol)) + @font-lock-builtin-face))) :feature 'decorator :language 'python