Skip to content

Commit b2bcaaa

Browse files
authored
Merge pull request #176 from nicolasstucki/quotes
Identify quotes/splices start as the start of a normal block
2 parents 69fe540 + be95818 commit b2bcaaa

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
@@ -591,8 +591,16 @@ export const scalaTmLanguage: TmLanguage = {
591591
]
592592
},
593593
'scala-quoted': {
594-
match: "('\\{|'\\[)(?!')",
595-
name: 'constant.other.quoted.scala'
594+
patterns: [
595+
{ // Start of `'{ .. }` or `${ .. }`
596+
match: "['$]\\{(?!')",
597+
name: 'punctuation.section.block.begin.scala'
598+
},
599+
{ // Start of `'[ .. ]`
600+
match: "'\\[(?!')",
601+
name: 'meta.bracket.scala'
602+
}
603+
]
596604
},
597605
'xml-doublequotedString': {
598606
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)