mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-10 15:30:01 -04:00
fix(python,starlark): builtin types should come after types
This commit is contained in:
parent
01b42a1a57
commit
87faf372eb
3 changed files with 39 additions and 37 deletions
|
|
@ -31,24 +31,6 @@
|
||||||
attribute: (identifier) @field)
|
attribute: (identifier) @field)
|
||||||
(#lua-match? @field "^.*%l.*$"))
|
(#lua-match? @field "^.*%l.*$"))
|
||||||
|
|
||||||
((identifier) @type.builtin
|
|
||||||
(#any-of? @type.builtin
|
|
||||||
;; https://docs.python.org/3/library/exceptions.html
|
|
||||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
|
||||||
"EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
|
|
||||||
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
|
||||||
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
|
||||||
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
|
||||||
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
|
||||||
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
|
||||||
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
|
||||||
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
|
||||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
|
||||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
|
||||||
;; https://docs.python.org/3/library/stdtypes.html
|
|
||||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
|
||||||
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (identifier) @type.definition
|
left: (identifier) @type.definition
|
||||||
(type (identifier) @_annotation))
|
(type (identifier) @_annotation))
|
||||||
|
|
@ -341,5 +323,23 @@
|
||||||
name: (identifier) @constructor)))
|
name: (identifier) @constructor)))
|
||||||
(#any-of? @constructor "__new__" "__init__"))
|
(#any-of? @constructor "__new__" "__init__"))
|
||||||
|
|
||||||
|
((identifier) @type.builtin
|
||||||
|
(#any-of? @type.builtin
|
||||||
|
;; https://docs.python.org/3/library/exceptions.html
|
||||||
|
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
||||||
|
"EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
|
||||||
|
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
||||||
|
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
||||||
|
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
||||||
|
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
||||||
|
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
||||||
|
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
||||||
|
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||||
|
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||||
|
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||||
|
;; https://docs.python.org/3/library/stdtypes.html
|
||||||
|
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
||||||
|
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
||||||
|
|
||||||
;; Error
|
;; Error
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
|
||||||
|
|
@ -31,24 +31,6 @@
|
||||||
attribute: (identifier) @field)
|
attribute: (identifier) @field)
|
||||||
(#lua-match? @field "^.*%l.*$"))
|
(#lua-match? @field "^.*%l.*$"))
|
||||||
|
|
||||||
((identifier) @type.builtin
|
|
||||||
(#any-of? @type.builtin
|
|
||||||
;; https://docs.python.org/3/library/exceptions.html
|
|
||||||
"ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
|
||||||
"EOFError" "FloatingPointError" "ModuleNotFoundError" "IndexError" "KeyError"
|
|
||||||
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
|
||||||
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
|
||||||
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
|
||||||
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
|
||||||
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
|
||||||
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
|
||||||
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
|
||||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
|
||||||
"FutureWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
|
||||||
;; https://docs.python.org/3/library/stdtypes.html
|
|
||||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
|
||||||
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type"))
|
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (identifier) @type.definition
|
left: (identifier) @type.definition
|
||||||
(type (identifier) @_annotation))
|
(type (identifier) @_annotation))
|
||||||
|
|
@ -106,6 +88,24 @@
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
(#eq? @_isinstance "isinstance"))
|
(#eq? @_isinstance "isinstance"))
|
||||||
|
|
||||||
|
((identifier) @type.builtin
|
||||||
|
(#any-of? @type.builtin
|
||||||
|
;; https://docs.python.org/3/library/exceptions.html
|
||||||
|
"ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
||||||
|
"EOFError" "FloatingPointError" "ModuleNotFoundError" "IndexError" "KeyError"
|
||||||
|
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
||||||
|
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
||||||
|
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
||||||
|
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
||||||
|
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
||||||
|
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
||||||
|
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||||
|
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||||
|
"FutureWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||||
|
;; https://docs.python.org/3/library/stdtypes.html
|
||||||
|
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
||||||
|
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type"))
|
||||||
|
|
||||||
;; Normal parameters
|
;; Normal parameters
|
||||||
(parameters
|
(parameters
|
||||||
(identifier) @parameter)
|
(identifier) @parameter)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
class Fields:
|
class Fields:
|
||||||
def __init__(self, fields):
|
def __init__(self, fields: list[int]) -> None:
|
||||||
|
# ^^^ @type.builtin
|
||||||
|
# ^^^^ @constant.builtin
|
||||||
self.fields = fields
|
self.fields = fields
|
||||||
# ^^^^^^ @field
|
# ^^^^^^ @field
|
||||||
self.__dunderfield__ = None
|
self.__dunderfield__ = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue