File tree 2 files changed +70
-2
lines changed 2 files changed +70
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const idUpper = `${upperLetter}${letterOrDigit}*(?:(?<=_)${opchar}+)?`
18
18
const idLower = `${ lowerLetter } ${ letterOrDigit } *(?:(?<=_)${ opchar } +)?`
19
19
const plainid = `(?:${ idrest } |${ opchar } +)`
20
20
const backQuotedId = "`[^`]+`"
21
-
21
+ const endOfLineMaybeWithComment = "(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)"
22
22
23
23
export const scalaTmLanguage : TmLanguage = {
24
24
fileTypes : [
@@ -486,9 +486,34 @@ export const scalaTmLanguage: TmLanguage = {
486
486
name : 'keyword.control.flow.scala'
487
487
} ,
488
488
{
489
- match : `^\\s*end(?= \\s+(if|while|for|match| ${ plainid } )\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$) ` ,
489
+ match : `^\\s*(end) \\s+(if|while|for|match) ${ endOfLineMaybeWithComment } ` ,
490
490
name : 'keyword.control.flow.end.scala'
491
491
} ,
492
+ {
493
+ match : `^\\s*(end)\\s+(?:(new)|(${ idUpper } ))${ endOfLineMaybeWithComment } ` ,
494
+ captures : {
495
+ '1' : {
496
+ name : 'keyword.declaration.end.scala'
497
+ } ,
498
+ '2' : {
499
+ name : 'keyword.declaration.end.scala'
500
+ } ,
501
+ '3' : {
502
+ name : 'entity.name.type.declaration'
503
+ }
504
+ }
505
+ } ,
506
+ {
507
+ match : `^\\s*(end)\\s+(${ backQuotedId } |${ plainid } )?${ endOfLineMaybeWithComment } ` ,
508
+ captures : {
509
+ '1' : {
510
+ name : 'keyword.declaration.end.scala'
511
+ } ,
512
+ '2' : {
513
+ name : 'entity.name.declaration'
514
+ }
515
+ }
516
+ } ,
492
517
{
493
518
match : '\\b(catch|finally|try)\\b' ,
494
519
name : 'keyword.control.exception.scala'
Original file line number Diff line number Diff line change
1
+ // SYNTAX TEST "source.scala"
2
+
3
+ new Foo :
4
+ // ^^^ keyword.declaration.scala
5
+ ...
6
+ end new
7
+ // ^^^ keyword.declaration.end.scala
8
+ // ^^^ keyword.declaration.end.scala
9
+
10
+ end if
11
+ // ^^^ keyword.control.flow.end.scala
12
+ // ^^ keyword.control.flow.end.scala
13
+
14
+ end while
15
+ // ^^^ keyword.control.flow.end.scala
16
+ // ^^^^^ keyword.control.flow.end.scala
17
+
18
+ end for
19
+ // ^^^ keyword.control.flow.end.scala
20
+ // ^^^ keyword.control.flow.end.scala
21
+
22
+ end match
23
+ // ^^^ keyword.control.flow.end.scala
24
+ // ^^^^^ keyword.control.flow.end.scala
25
+
26
+ class Foo
27
+ // ^^^ entity.name.class.declaration
28
+ end Foo
29
+ // ^^^ keyword.declaration.end.scala
30
+ // ^^^ entity.name.type.declaration
31
+
32
+ def foo
33
+ // ^^^ entity.name.function.declaration
34
+ end bar
35
+ // ^^^ keyword.declaration.end.scala
36
+ // ^^^ entity.name.declaration
37
+
38
+ end `bar`
39
+ // ^^^ keyword.declaration.end.scala
40
+ // ^^^ entity.name.declaration
41
+
42
+ end
43
+ // ^^^ keyword.declaration.end.scala
You can’t perform that action at this time.
0 commit comments