diff options
| author | Salomon Popp <hi@salomonpopp.me> | 2025-03-13 09:21:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-13 09:21:55 +0100 |
| commit | 683816f14718b257666b29f792a8d330936cf5c1 (patch) | |
| tree | ca73997c9ec2a242cfc4956e25a36901c472a950 /tests/query/highlights/python | |
| parent | bot(lockfile): update cmake, liquid, meson, tera, v, vhdl (diff) | |
| download | nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar.gz nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar.bz2 nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar.lz nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar.xz nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.tar.zst nvim-treesitter-683816f14718b257666b29f792a8d330936cf5c1.zip | |
fix(python): don't highlight parameter name as builtin (#7732)
Diffstat (limited to 'tests/query/highlights/python')
| -rw-r--r-- | tests/query/highlights/python/fields.py | 15 | ||||
| -rw-r--r-- | tests/query/highlights/python/functions.py | 5 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/query/highlights/python/fields.py b/tests/query/highlights/python/fields.py index cea9eccb7..cbe80cdc2 100644 --- a/tests/query/highlights/python/fields.py +++ b/tests/query/highlights/python/fields.py @@ -2,12 +2,15 @@ class Fields: type: str # ^^^^ @variable.member - def __init__(self, fields: list[int]) -> None: -# ^^^ @type.builtin -# ^^^^ @constant.builtin + def __init__(self, type: str, fields: list[int]) -> None: +# ^^^^ @variable.builtin +# ^^^^ @variable.parameter +# ^^^^^^ @variable.parameter +# ^^^ @type.builtin +# ^^^^ @constant.builtin self.fields = fields # ^^^^^^ @variable.member - self.type = "foo" + self.type = type # this cannot be highlighted correctly by Treesitter # ^^^^ @variable.member self.__dunderfield__ = None # ^^^^^^^^^^^^^^^ @variable.member @@ -15,3 +18,7 @@ class Fields: # ^^^^^^^^^^^ @variable.member self.NOT_A_FIELD = "IM NOT A FIELD" # ^^^^^^^^^^^ @constant + +Fields(type="schema", fields=[0, 1]) +# ^^^^ @variable.parameter +# ^^^^^^ @variable.parameter diff --git a/tests/query/highlights/python/functions.py b/tests/query/highlights/python/functions.py index 6d3028433..7284d3fcc 100644 --- a/tests/query/highlights/python/functions.py +++ b/tests/query/highlights/python/functions.py @@ -8,6 +8,11 @@ _ = func() class Foo: def method(self) -> None: ... +# ^^^^ @variable.builtin + + @classmethod + def clsmethod(cls) -> None: ... +# ^^^ @variable.builtin Foo().method() # ^^^^^^ @function.method.call |
