From e0c824aaddba4e492ca2f2ad616564293dbad3c1 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 15 Sep 2020 13:49:24 +0200 Subject: [PATCH] Prioritize matching of inline parameters --- src/typescript/Scala.tmLanguage.ts | 8 ++++---- tests/unit/#133.test.scala | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index c7db34c..85784b7 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -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' } } } diff --git a/tests/unit/#133.test.scala b/tests/unit/#133.test.scala index ab7ecb8..e2b6516 100644 --- a/tests/unit/#133.test.scala +++ b/tests/unit/#133.test.scala @@ -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