Skip to content

Commit be95818

Browse files
committed
Identify quotes/splices start as the start of a normal block
1 parent 0352d72 commit be95818

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/typescript/Scala.tmLanguage.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,16 @@ export const scalaTmLanguage: TmLanguage = {
590590
]
591591
},
592592
'scala-quoted': {
593-
match: "('\\{|'\\[)(?!')",
594-
name: 'constant.other.quoted.scala'
593+
patterns: [
594+
{ // Start of `'{ .. }` or `${ .. }`
595+
match: "['$]\\{(?!')",
596+
name: 'punctuation.section.block.begin.scala'
597+
},
598+
{ // Start of `'[ .. ]`
599+
match: "'\\[(?!')",
600+
name: 'meta.bracket.scala'
601+
}
602+
]
595603
},
596604
'xml-doublequotedString': {
597605
end: '"',

tests/unit/quoted.test.scala

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
// SYNTAX TEST "source.scala"
22

33
'{ 2 }
4-
// ^^ constant.other.quoted.scala
4+
// ^^ punctuation.section.block.begin.scala
55
// ^ constant.numeric.scala
66
// ^ punctuation.section.block.end.scala
77

88
'[ String ]
9-
// ^^ constant.other.quoted.scala
9+
// ^^ meta.bracket.scala
1010
// ^^^^^^ entity.name.class
11+
// ^ meta.bracket.scala
12+
13+
14+
${ 1 }
15+
// ^^ punctuation.section.block.begin.scala
16+
// ^ constant.numeric.scala
17+
// ^ punctuation.section.block.end.scala
18+
19+
case '{ x } =>
20+
// ^^^^ keyword.control.flow.scala
21+
// ^^ punctuation.section.block.begin.scala
22+
// ^ punctuation.section.block.end.scala
23+
24+
case '[ T ] =>
25+
// ^^^^ keyword.control.flow.scala
26+
// ^^ meta.bracket.scala
1127
// ^ meta.bracket.scala

0 commit comments

Comments
 (0)