Skip to content

Capture using followed by quote splice #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export const scalaTmLanguage: TmLanguage = {
'using': {
patterns: [
{
match: `(?<=\\()\\s*(using)\\s+(?=[\\w\\d\\(\\.\\(\\{'"])`,
match: `(?<=\\()\\s*(using)\\s`,
captures: {
'1': {
name: 'keyword.declaration.scala'
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/#180.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SYNTAX TEST "source.scala"

case '{ Array[T]()(using $ct) } =>
// ^^^^^ keyword.declaration.scala

case '{ Array[T]()(using ($ct: ClassTag[T])) } =>
// ^^^^^ keyword.declaration.scala
18 changes: 17 additions & 1 deletion tests/unit/using.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,20 @@ given [T](using Ord[T]) as Ord[List[T]]

f(using "")
// ^^^^^ keyword.declaration.scala
// ^^ string.quoted.double.scala
// ^^ string.quoted.double.scala

val using = ...
// ^^^^^ - keyword.declaration.scala
val using: X = ...
// ^^^^^ - keyword.declaration.scala
def using() = ...
// ^^^^^ - keyword.declaration.scala

using(foo)
// ^^^^^ - keyword.declaration.scala
bar(using(foo))
// ^^^^^ - keyword.declaration.scala
bar(using.apply(foo))
// ^^^^^ - keyword.declaration.scala
using.apply(foo)
// ^^^^^ - keyword.declaration.scala