diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 4951b02..4490d74 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -73,18 +73,21 @@ scopes: 'interpolation > "}"': 'punctuation.section.embedded' 'class_definition > identifier': 'entity.name.type.class' - 'function_definition > identifier': 'entity.name.function' + 'function_definition > identifier': 'entity.name.function.definition' 'call > identifier:nth-child(0)': [ {match: '^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$', - scopes: 'support.function'}, - 'entity.name.function' + scopes: 'support.function.call'}, + {match: '^[A-Z]', scopes: 'support.type.contructor'} + 'entity.name.function.call' ] 'call > attribute > identifier:nth-child(2)': 'entity.name.function' - 'identifier': + 'identifier': [ {match: '^(BaseException|Exception|TypeError|StopAsyncIteration|StopIteration|ImportError|ModuleNotFoundError|OSError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|BlockingIOError|ChildProcessError|FileExistsError|FileNotFoundError|IsADirectoryError|NotADirectoryError|InterruptedError|PermissionError|ProcessLookupError|TimeoutError|EOFError|RuntimeError|RecursionError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|LookupError|IndexError|KeyError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|AssertionError|ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|SystemError|ReferenceError|BufferError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning|GeneratorExit|SystemExit|KeyboardInterrupt)$' - scopes: 'support.type.exception'} + scopes: 'support.type.exception'}, + {match: '^(self)', scopes: 'entity.name.variable.self'} + ] 'attribute > identifier:nth-child(2)': 'variable.other.object.property' @@ -115,6 +118,10 @@ scopes: 'parameters > dictionary_splat > identifier': 'variable.parameter.function' 'default_parameter > identifier:nth-child(0)': 'variable.parameter.function' 'keyword_argument > identifier:nth-child(0)': 'variable.parameter.function' + 'lambda_parameters > identifier': 'variable.parameter.function' + 'typed_parameter > identifier': 'variable.parameter.function' + + 'argument_list': 'meta.method-call.python' '"if"': 'keyword.control' '"else"': 'keyword.control' @@ -177,3 +184,12 @@ scopes: '"or"': 'keyword.operator.logical.python' '"not"': 'keyword.operator.logical.python' '"is"': 'keyword.operator.logical.python' + '"->"': 'keyword.control.return' + + '"["': 'punctuation.definition.begin.bracket.square' + '"]"': 'punctuation.definition.end.bracket.square' + '","': 'punctuation.separator.delimiter' + '"{"': 'punctuation.section.block.begin.bracket.curly' + '"}"': 'punctuation.section.block.end.bracket.curly' + '"("': 'punctuation.section.parens.begin.bracket.round' + '")"': 'punctuation.section.parens.end.bracket.round' diff --git a/package-lock.json b/package-lock.json index 6b7f3c4..d6acf3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -123,9 +123,9 @@ "dev": true }, "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" }, "once": { "version": "1.4.0", @@ -165,9 +165,9 @@ "dev": true }, "tree-sitter-python": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.15.1.tgz", - "integrity": "sha512-v8HUvx6JnaRNiLM2ur+T5dVEoUKanXYv8vqHWGNzjiyt+vluHKySGR7fWeQVcaotDSulDJfil4Zbye2qIPVKSA==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.17.0.tgz", + "integrity": "sha512-6HaqF/1GHB0/qrkcIxYqEELsQq6bXdQxx2KnGLZhoGn5ipbAibncSuQT9f8HYbmqLZ4dIGleQzsXreY1mx2lig==", "requires": { "nan": "^2.4.0" } diff --git a/package.json b/package.json index 930febc..986bde6 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "atom-grammar-test": "^0.6.4", - "tree-sitter-python": "^0.15.1" + "tree-sitter-python": "^0.17.0" }, "devDependencies": { "coffeelint": "^1.10.1"