Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

python: Add dunder variables highlighting (#58158)

Alex Lachanceb914ba5cb3f4
diff --git a/crates/grammars/src/python/highlights.scm b/crates/grammars/src/python/highlights.scm
index 00daf43fbc3..7641cef1179 100644
--- a/crates/grammars/src/python/highlights.scm
+++ b/crates/grammars/src/python/highlights.scm
@@ -338,6 +338,16 @@
(identifier) @attribute.builtin
(#any-of? @attribute.builtin "classmethod" "staticmethod" "property"))
+(attribute
+ attribute: (identifier) @attribute.special
+ (#any-of? @attribute.special
+ "__all__" "__annotations__" "__bases__" "__builtins__" "__class__" "__closure__" "__code__"
+ "__debug__" "__defaults__" "__dict__" "__doc__" "__file__" "__func__" "__globals__"
+ "__kwdefaults__" "__match_args__" "__members__" "__metaclass__" "__methods__" "__module__"
+ "__mro__" "__mro_entries__" "__name__" "__qualname__" "__post_init__" "__self__" "__signature__"
+ "__slots__" "__subclasses__" "__version__" "__weakref__" "__wrapped__" "__classcell__"
+ "__spec__" "__path__" "__package__" "__future__" "__traceback__"))
+
; Builtin types as identifiers
[
(call