Skip to content

Commit e56c181

Browse files
Thomas Smithwbond
Thomas Smith
authored andcommitted
[JavaScript] Distinguish the comma operator from comma punctuation. (#1551)
1 parent d5a2f8e commit e56c181

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

JavaScript/JavaScript.sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ contexts:
10381038
scope: keyword.operator.arithmetic.js
10391039
push: expression-begin
10401040
- match: ','
1041-
scope: punctuation.separator.comma.js # TODO: Change to keyword.operator.comma.js ?
1041+
scope: keyword.operator.comma.js # Comma operator, not punctuation.
10421042
push: expression-begin
10431043

10441044
ternary-operator:

JavaScript/tests/syntax_test_js.js

+11
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,17 @@ var re = /^\/[^/]+/;
13521352
// ^ keyword.operator.arithmetic
13531353
y / ((x - 1) / -2);
13541354

1355+
1, 2;
1356+
// ^ keyword.operator.comma - punctuation
1357+
1358+
a;
1359+
[1, 2];
1360+
// ^ meta.sequence punctuation.separator.comma - meta.brackets - keyword
1361+
1362+
a
1363+
[1, 2];
1364+
// ^ meta.brackets keyword.operator.comma - meta.sequence - punctuation
1365+
13551366
define(['common'], function(common) {
13561367
// ^ meta.function.declaration
13571368
var namedFunc = function() {

0 commit comments

Comments
 (0)