Skip to content

Add top level rule for identifiers inside the backticks #38

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 1 commit into from
Jun 25, 2019
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
9 changes: 9 additions & 0 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ export const scalaTmLanguage: TmLanguage = {
{
include: '#qualifiedClassName'
},
{
include: '#backQuotedVariable'
},
{
include: '#meta-brackets'
},
Expand Down Expand Up @@ -624,6 +627,12 @@ export const scalaTmLanguage: TmLanguage = {
}
}
},
backQuotedVariable: {
// capture back quoted variables in code so special symbols inside them do not
// interfere with the rest of the rules. But don't assign any extra scope, to make them
// consistent with the rest of variables
match: `${backQuotedId}`
},
'storage-modifiers': {
patterns: [
{
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/Scala.tmLanguage.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions tests/snap/backticks.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

object `Backtics test` {
val x = MediaRange.`*/*`

val y = `MediaRange`.`*/*`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to enjoy this fix on GitHub.com 😄

Screenshot 2019-06-25 at 13 26 48


val z = `Media Range`

def `*/*`(`a b`: `C D`): `e f` = ???



val `*/*` = 5
}
74 changes: 74 additions & 0 deletions tests/snap/backticks.test.scala.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
>
>object `Backtics test` {
#^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^^^^ source.scala entity.name.class.declaration
# ^^^^^^^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
> val x = MediaRange.`*/*`
#^^^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^ source.scala variable.other.declaration.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
# ^^^^^^^^^^ source.scala entity.name.class
# ^ source.scala
# ^^^^^ source.scala
>
> val y = `MediaRange`.`*/*`
#^^^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^ source.scala variable.other.declaration.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
# ^^^^^^^^^^^^ source.scala
# ^ source.scala
# ^^^^^ source.scala
>
> val z = `Media Range`
#^^^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^ source.scala variable.other.declaration.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
# ^^^^^^^^^^^^^ source.scala
>
> def `*/*`(`a b`: `C D`): `e f` = ???
#^^^^ source.scala
# ^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^ source.scala entity.name.function.declaration
# ^ source.scala meta.bracket.scala
# ^^^^^ source.scala variable.parameter.scala
# ^ source.scala meta.colon.scala
# ^ source.scala
# ^^^^^ source.scala
# ^ source.scala meta.bracket.scala
# ^ source.scala keyword.operator.scala
# ^ source.scala
# ^^^^^ source.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
# ^^^ source.scala keyword.operator.scala
>
>
>
> val `*/*` = 5
#^^^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^^^^^ source.scala variable.other.declaration.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
# ^ source.scala constant.numeric.scala
> }
#^ source.scala
# ^ source.scala punctuation.section.block.end.scala
4 changes: 3 additions & 1 deletion tests/snap/scala_spec.test.scala.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,9 @@
> case `y` =>
#^^^^^^^^ source.scala
# ^^^^ source.scala keyword.control.flow.scala
# ^^^^^ source.scala
# ^ source.scala
# ^^^ source.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala keyword.operator.comparison.scala
# ^^ source.scala
Expand Down