From f4c10fee77e5c0a73644020e2c5f00738fe39570 Mon Sep 17 00:00:00 2001 From: thom Date: Wed, 9 May 2018 14:17:20 -0400 Subject: [PATCH] [JavaScript] Distinguish the comma operator from comma punctuation. --- JavaScript/JavaScript.sublime-syntax | 2 +- JavaScript/tests/syntax_test_js.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index 408873c68a..04b9d1dc3f 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -1038,7 +1038,7 @@ contexts: scope: keyword.operator.arithmetic.js push: expression-begin - match: ',' - scope: punctuation.separator.comma.js # TODO: Change to keyword.operator.comma.js ? + scope: keyword.operator.comma.js # Comma operator, not punctuation. push: expression-begin ternary-operator: diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index e5bec29f51..a6e049df94 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -1329,6 +1329,17 @@ var re = /^\/[^/]+/; // ^ keyword.operator.arithmetic y / ((x - 1) / -2); + 1, 2; +// ^ keyword.operator.comma - punctuation + + a; + [1, 2]; +// ^ meta.sequence punctuation.separator.comma - meta.brackets - keyword + + a + [1, 2]; +// ^ meta.brackets keyword.operator.comma - meta.sequence - punctuation + define(['common'], function(common) { // ^ meta.function.declaration var namedFunc = function() {