From 3400412da6a6b67191b3d473262c7e9058b85510 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 29 Jun 2020 12:31:28 +0200 Subject: [PATCH] Fix #69: Do not use type definitions to highlight `.type` --- src/typescript/Scala.tmLanguage.ts | 13 ++++++++++++- tests/unit/#69.test.scala | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/unit/#69.test.scala diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index 80870a0..c4afc60 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -174,6 +174,9 @@ export const scalaTmLanguage: TmLanguage = { { include: '#scala-symbol' }, + { + include: '#singleton-type' + }, { include: '#scala-quoted' }, @@ -431,6 +434,14 @@ export const scalaTmLanguage: TmLanguage = { } ] }, + 'singleton-type': { + match: `\\.(type)(?!${idrest}|[0-9])`, + captures: { + '1': { + name: 'keyword.type.scala' + } + } + }, 'scala-quoted': { match: "('\\{|'\\[)(?!')", name: 'constant.other.quoted.scala' @@ -494,7 +505,7 @@ export const scalaTmLanguage: TmLanguage = { } }, { - match: `\\b(type)\\s+(${backQuotedId}|${plainid})`, + match: `(?