From e04d8bcd2c0e8d22e8f27d62ffdfa0d164feb451 Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Thu, 1 Nov 2018 15:40:24 +0100 Subject: [PATCH 1/7] Add more scopes to the tree-sitter grammar --- grammars/tree-sitter-javascript.cson | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index ca9b700b..71fac84a 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -136,6 +136,9 @@ scopes: '")"': 'punctuation.definition.parameters.end.bracket.round' '"{"': 'punctuation.definition.function.body.begin.bracket.curly' '"}"': 'punctuation.definition.function.body.end.bracket.curly' + '";"': 'punctuation.terminator.statement.semicolon' + '"["': 'punctuation.definition.array.begin.bracket.square' + '"]"': 'punctuation.definition.array.end.bracket.square' '"var"': 'storage.type' '"let"': 'storage.type' @@ -199,6 +202,7 @@ scopes: '"."': 'meta.delimiter' '","': 'meta.delimiter' + '"as"': 'keyword.control' '"if"': 'keyword.control' '"do"': 'keyword.control' '"else"': 'keyword.control' From 9be2756d4b67eaf0297ebbd21ae13c1b680dbd7e Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Thu, 1 Nov 2018 17:46:25 +0100 Subject: [PATCH 2/7] Style arugments and super as variable.language --- grammars/tree-sitter-javascript.cson | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index 71fac84a..e7d8f358 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -94,11 +94,16 @@ scopes: 'method_definition > property_identifier': 'entity.name.function' 'call_expression > member_expression > property_identifier': 'entity.name.function' + 'super': 'variable.language' + 'identifier': [ { match: '^(global|module|exports|__filename|__dirname|window|document)$', scopes: 'support.variable' }, + { + exact: 'arguments', + scopes:'variable.language'}, { exact: 'require', scopes: 'support.function' } From 2772c289a553da74dcd433d1081b110388e8bcbc Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Thu, 1 Nov 2018 19:27:04 +0100 Subject: [PATCH 3/7] :art: --- grammars/tree-sitter-javascript.cson | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index e7d8f358..8f23a3d6 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -103,10 +103,12 @@ scopes: }, { exact: 'arguments', - scopes:'variable.language'}, + scopes:'variable.language' + }, { - exact: 'require', scopes: 'support.function' - } + exact: 'require', + scopes: 'support.function' + }, { match: '^[\$A-Z_]{2,}$', scopes: 'constant.other' From 8c513eb0a96f54aac61612c0b944c72b8df6ffe4 Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Thu, 1 Nov 2018 19:40:36 +0100 Subject: [PATCH 4/7] Scope this as variable.language --- grammars/tree-sitter-javascript.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index 8f23a3d6..8dbaaed0 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -94,6 +94,7 @@ scopes: 'method_definition > property_identifier': 'entity.name.function' 'call_expression > member_expression > property_identifier': 'entity.name.function' + 'this': 'variable.language' 'super': 'variable.language' 'identifier': [ From b427615eddf4ab9c7ce4ad1a6a4f5ebc1291997e Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Thu, 1 Nov 2018 20:09:31 +0100 Subject: [PATCH 5/7] Add a more specific scope for a call to super --- grammars/tree-sitter-javascript.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index 8dbaaed0..b6a3d0e5 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -89,7 +89,7 @@ scopes: 'entity.name.function' ] - 'call_expression > super': 'support.function' + 'call_expression > super': 'support.function.super' 'method_definition > property_identifier': 'entity.name.function' 'call_expression > member_expression > property_identifier': 'entity.name.function' From e615da4207d1028820ddc19b417389cf78c03ab2 Mon Sep 17 00:00:00 2001 From: Linus Eriksson Date: Sat, 3 Nov 2018 09:17:21 +0100 Subject: [PATCH 6/7] Add arrow to the function to match textmate Refs https://github.com/atom/language-javascript/issues/566 --- grammars/tree-sitter-javascript.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index b6a3d0e5..3fe576d3 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -155,7 +155,7 @@ scopes: '"const"': 'storage.modifier' '"static"': 'storage.modifier' '"function"': 'storage.type.function' - '"=>"': 'storage.type.function' + '"=>"': 'storage.type.function.arrow' '"="': 'keyword.operator.js' '"+="': 'keyword.operator.js' From cab77b6babf538836db2bc6cdfff60ec960a6fbf Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 8 Nov 2018 13:28:57 -0800 Subject: [PATCH 7/7] Remove language.variable scope mappings for now --- grammars/tree-sitter-javascript.cson | 7 ------- 1 file changed, 7 deletions(-) diff --git a/grammars/tree-sitter-javascript.cson b/grammars/tree-sitter-javascript.cson index 3fe576d3..b67318a8 100644 --- a/grammars/tree-sitter-javascript.cson +++ b/grammars/tree-sitter-javascript.cson @@ -94,18 +94,11 @@ scopes: 'method_definition > property_identifier': 'entity.name.function' 'call_expression > member_expression > property_identifier': 'entity.name.function' - 'this': 'variable.language' - 'super': 'variable.language' - 'identifier': [ { match: '^(global|module|exports|__filename|__dirname|window|document)$', scopes: 'support.variable' }, - { - exact: 'arguments', - scopes:'variable.language' - }, { exact: 'require', scopes: 'support.function'