]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix python-ts-mode built-in functions and attributes (bug#70478)
authorPrateek Sharma <ps.prateek.sharma143@gmail.com>
Fri, 19 Apr 2024 20:36:17 +0000 (02:06 +0530)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Apr 2024 15:01:17 +0000 (17:01 +0200)
* 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.

(cherry picked from commit afd0b548fcc5e141528a442ff9100fe8e2b98f21)

lisp/progmodes/python.el

index 85279d3e84b780c7d13a6dcf4b3f8a6b6a4e1eef..d6c29e5ffc68d137bb151c32169ebf756383976d 100644 (file)
@@ -1206,13 +1206,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