Skip to content

Commit

Permalink
Prioritize matching of inline parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Sep 15, 2020
1 parent 806d9a7 commit e0c824a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,18 @@ export const scalaTmLanguage: TmLanguage = {
inline: {
patterns: [
{
match: `\\b(inline)\\b(?=(?:.(?!\\b(?:val|def|given)\\b))*\\b(if|match)\\b)`,
match: `\\b(inline)\\s+(?=(([\\w\\s]*\\b(val|def|given)\\b)|(${plainid}|${backQuotedId})\\s*:))`,
captures: {
'1': {
name: 'keyword.control.flow.scala'
name: 'storage.modifier.other'
}
}
},
{
match: `\\b(inline)\\s+(?=(([\\w\\s]*\\b(val|def|given)\\b)|(${plainid}|${backQuotedId})\\s*:))`,
match: `\\b(inline)\\b(?=(?:.(?!\\b(?:val|def|given)\\b))*\\b(if|match)\\b)`,
captures: {
'1': {
name: 'storage.modifier.other'
name: 'keyword.control.flow.scala'
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/#133.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ val x = inline[T]
// ^^^^^^ storage.modifier.other
// ^^^^^^ variable.parameter.scala

inline def inline(inline x: Int): Double = if
// ^^^^^^ storage.modifier.other
// ^^^^^^ entity.name.function.declaration
// ^^^^^^ storage.modifier.other
// ^ variable.parameter.scala

inline if (n == 0) 1 else 2; val x = 2
// ^^^^^^ keyword.control.flow.scala
// ^^ keyword.control.flow.scala
Expand Down

0 comments on commit e0c824a

Please sign in to comment.