Skip to content

Commit 98fef6c

Browse files
Merge pull request #101 from sparecycles/fix/issue-96
Fix var/let highlighting (issue 96)
2 parents c49cb36 + f62cf17 commit 98fef6c

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ patterns:
1111
repository:
1212
var-expr:
1313
name: meta.var.expr.ts
14-
begin: (?<!\()\s*\b(var|let|const(?!\s+enum)\b)
14+
begin: (?<!\()\s*\b(var|let|const(?!\s+enum))\b
1515
beginCaptures:
1616
'1': { name: storage.type.ts }
1717
end: (?=$|;)

TypeScript.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@
17561756
<key>var-expr</key>
17571757
<dict>
17581758
<key>begin</key>
1759-
<string>(?&lt;!\()\s*\b(var|let|const(?!\s+enum)\b)</string>
1759+
<string>(?&lt;!\()\s*\b(var|let|const(?!\s+enum))\b</string>
17601760
<key>beginCaptures</key>
17611761
<dict>
17621762
<key>1</key>

TypeScriptReact.YAML-tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ patterns:
1313
repository:
1414
var-expr:
1515
name: meta.var.expr.tsx
16-
begin: (?<!\()\s*\b(var|let|const(?!\s+enum)\b)
16+
begin: (?<!\()\s*\b(var|let|const(?!\s+enum))\b
1717
beginCaptures:
1818
'1': { name: storage.type.tsx }
1919
end: (?=$|;)

TypeScriptReact.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@
21222122
<key>var-expr</key>
21232123
<dict>
21242124
<key>begin</key>
2125-
<string>(?&lt;!\()\s*\b(var|let|const(?!\s+enum)\b)</string>
2125+
<string>(?&lt;!\()\s*\b(var|let|const(?!\s+enum))\b</string>
21262126
<key>beginCaptures</key>
21272127
<dict>
21282128
<key>1</key>

tests/baselines/Issue96.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[1, 4]: source.ts meta.var.expr.ts
2+
[2, 4]: source.ts meta.var.expr.ts
3+
[4, 4]: source.ts
4+
[5, 4]: source.ts
5+
[7, 10]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.ts
6+
[7, 14]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
7+
[8, 6]: source.ts
8+
[8, 10]: source.ts
9+
[9, 6]: source.ts meta.enum.declaration.ts
10+
[9, 11]: source.ts meta.enum.declaration.ts
11+
[11, 10]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.ts
12+
[11, 14]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
13+
[12, 6]: source.ts
14+
[12, 10]: source.ts

tests/cases/Issue96.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var^^ letter;
2+
let^^ variable;
3+
4+
var^^iable;
5+
let^^ter;
6+
7+
var const^^enum^^ = 10;
8+
const^^enum^^ += 10;
9+
const^^ enum^^ E { }
10+
11+
var const^^able^^ = "I am rrrrrroyal!";
12+
const^^able^^ += " Royal, I say!";

0 commit comments

Comments
 (0)