mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix(python): don't highlight parameter name as builtin (#7732)
This commit is contained in:
parent
178a68b7ff
commit
683816f147
3 changed files with 77 additions and 65 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue