Skip to content

Commit 16d49e5

Browse files
committed
Fix #118: Detect start of anonymous new
1 parent 5b19916 commit 16d49e5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/typescript/Scala.tmLanguage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export const scalaTmLanguage: TmLanguage = {
729729
name: 'string.quoted.other constant.character.literal.scala'
730730
},
731731
initialization: {
732-
match: '\\b(new)\\s+([^\\s,\\{\\}\\(\\)\\[\\]]+)',
732+
match: '\\b(new)\\s+([^\\s,\\{\\}\\(\\)\\[\\]]+|(?=\\{))',
733733
captures: {
734734
'1': {
735735
name: 'keyword.declaration.scala'

tests/unit/#118.test.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SYNTAX TEST "source.scala"
2+
3+
new A
4+
// ^^^ keyword.declaration.scala
5+
// ^ entity.name.class
6+
7+
new { }
8+
// ^^^ keyword.declaration.scala
9+
// ^ punctuation.section.block.begin.scala
10+
// ^ punctuation.section.block.end.scala

0 commit comments

Comments
 (0)