From faf1e57ccbddbf7f7378bd085e5bff77090403cb Mon Sep 17 00:00:00 2001 From: aminya Date: Wed, 28 Oct 2020 18:17:41 -0500 Subject: [PATCH 01/13] :arrow_up: Update tree-sitter-python --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6b7f3c4..06766ea 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.16.1", + "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.16.1.tgz", + "integrity": "sha512-XUxJgecoSZwNYUD+Pfb16pjPmK16T+bqhNdGkX/pgXvaEniaeVLpZP0VSiRpBq7Dx5vaXQcTn1/2MhUxoVBCdg==", "requires": { "nan": "^2.4.0" } diff --git a/package.json b/package.json index 930febc..e7f0cb8 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.16.1" }, "devDependencies": { "coffeelint": "^1.10.1" From ad4b9807280c9f38cb537539c43890b143188012 Mon Sep 17 00:00:00 2001 From: aminya Date: Wed, 28 Oct 2020 21:25:48 -0500 Subject: [PATCH 02/13] Update Travis linux distro --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 47ee9a1..eb88ec4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ git: sudo: false -dist: trusty +dist: bionic addons: apt: From ebe88306700ef0face8c9a99b5fc2a1d4e059866 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 10:51:27 -0600 Subject: [PATCH 03/13] :arrow_up: bump tree-sitter-python to 0.17.0 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06766ea..d6acf3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,9 +165,9 @@ "dev": true }, "tree-sitter-python": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.16.1.tgz", - "integrity": "sha512-XUxJgecoSZwNYUD+Pfb16pjPmK16T+bqhNdGkX/pgXvaEniaeVLpZP0VSiRpBq7Dx5vaXQcTn1/2MhUxoVBCdg==", + "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 e7f0cb8..986bde6 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "atom-grammar-test": "^0.6.4", - "tree-sitter-python": "^0.16.1" + "tree-sitter-python": "^0.17.0" }, "devDependencies": { "coffeelint": "^1.10.1" From d989f9aee9638ba48e2018fa81dc9a9b1b200dda Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 11:59:34 -0600 Subject: [PATCH 04/13] Add keyword.control.return Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 4951b02..cb1b6d1 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -177,3 +177,4 @@ scopes: '"or"': 'keyword.operator.logical.python' '"not"': 'keyword.operator.logical.python' '"is"': 'keyword.operator.logical.python' + '"->"': 'keyword.control.return' From c2b79f1aebf91c507a0b469e4d201a92c76ad95a Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:00:27 -0600 Subject: [PATCH 05/13] Add punctuations Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index cb1b6d1..07d5562 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -178,3 +178,11 @@ scopes: '"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' From 6325ed1445d53c5519e37b0597d0ae608bdb0a84 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:01:25 -0600 Subject: [PATCH 06/13] Use function.def for function_definition Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 07d5562..3abe778 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -73,7 +73,7 @@ scopes: 'interpolation > "}"': 'punctuation.section.embedded' 'class_definition > identifier': 'entity.name.type.class' - 'function_definition > identifier': 'entity.name.function' + 'function_definition > identifier': 'entity.name.function.def' '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'}, From 89351c1a3acd79e77b00474da135d7ea9f4c2e1f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:02:40 -0600 Subject: [PATCH 07/13] Use function.call for call Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 3abe778..bfed062 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -76,8 +76,8 @@ scopes: 'function_definition > identifier': 'entity.name.function.def' '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'}, + 'entity.name.function.call' ] 'call > attribute > identifier:nth-child(2)': 'entity.name.function' From b0a77d570ce7d39484b4b8d02963d618b0537585 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:03:16 -0600 Subject: [PATCH 08/13] Support constructor Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index bfed062..bbbcd80 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -77,6 +77,7 @@ scopes: '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.call'}, + {match: '^[A-Z]', scopes: 'support.type.contructor'} 'entity.name.function.call' ] 'call > attribute > identifier:nth-child(2)': 'entity.name.function' From 37c8e1d9e8bda4d875e2892d777e4b29f8218236 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:15:56 -0600 Subject: [PATCH 09/13] Support lambda parameters Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index bbbcd80..7067f19 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -116,6 +116,7 @@ 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' '"if"': 'keyword.control' '"else"': 'keyword.control' From 98cab1961c654b66ac60c5d57b57346983ce00fe Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:09:04 -0600 Subject: [PATCH 10/13] Support typed parameters Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 7067f19..166d657 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -117,6 +117,7 @@ scopes: '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' '"if"': 'keyword.control' '"else"': 'keyword.control' From 6e5de571a361d82c7c9c2fa86f6295227820273f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:13:29 -0600 Subject: [PATCH 11/13] Support self matching Co-Authored-By: Eric Shimizu Karbstein <17973728+GrayJack@users.noreply.github.com> --- grammars/tree-sitter-python.cson | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 166d657..fa18df4 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -82,10 +82,12 @@ scopes: ] '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' From 4d966074bfb6267e09416b9004f2e5770c5b9dfb Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:53:27 -0600 Subject: [PATCH 12/13] Support argument list https://github.com/tree-sitter/tree-sitter-python/issues/96 --- grammars/tree-sitter-python.cson | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index fa18df4..f97ca81 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -121,6 +121,8 @@ scopes: 'lambda_parameters > identifier': 'variable.parameter.function' 'typed_parameter > identifier': 'variable.parameter.function' + 'argument_list': 'meta.method-call.python' + '"if"': 'keyword.control' '"else"': 'keyword.control' '"elif"': 'keyword.control' From 5d548707cec8c150f4844d9a1cd744dd9641c6ef Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 8 Jan 2021 12:57:51 -0600 Subject: [PATCH 13/13] use entity.name.function.definition --- grammars/tree-sitter-python.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index f97ca81..4490d74 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -73,7 +73,7 @@ scopes: 'interpolation > "}"': 'punctuation.section.embedded' 'class_definition > identifier': 'entity.name.type.class' - 'function_definition > identifier': 'entity.name.function.def' + '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.call'},