Skip to content

Fix #141: Remove old extension on syntax #142

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
Sep 7, 2020
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
16 changes: 1 addition & 15 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1008,21 +1008,7 @@ export const scalaTmLanguage: TmLanguage = {
extension: {
patterns: [
{
match: `(extension)\\s+(?:(${plainid})\\s)?\\s*(on|(?=\\{))`,
captures: {
'1': {
name: 'keyword.declaration.scala'
},
'2': {
name: 'entity.name.class'
},
'3': {
name: 'keyword.declaration.scala'
}
}
},
{
match: `(extension)\\s+(?=[\\[\\(])`,
match: `^\\s*(extension)\\s+(?=[\\[\\(])`,
captures: {
'1': {
name: 'keyword.declaration.scala'
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/#141.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SYNTAX TEST "source.scala"

val language = file.extension {
// ^^^^^^^^^ - keyword.declaration.scala
val language = file extension {
// ^^^^^^^^^ - keyword.declaration.scala
val language = file.extension(
// ^^^^^^^^^ - keyword.declaration.scala
val language = file extension (
// ^^^^^^^^^ - keyword.declaration.scala
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this assert its highlighted as a keyword? I expected it to be highlighted the same as “file”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The - checks that it is not a keyword.declaration.scala

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha, I'm not so familiar with the testing infrastructure. Great!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I discovered that one today. It must be new, I don't remember seeing it in the first version of the testing infrastructure we use.

16 changes: 9 additions & 7 deletions tests/unit/extension-on.test.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// SYNTAX TEST "source.scala"

// Old syntax is not supported anymore. We make sure that it is not accidentally highlighted.

extension on (x: Rational):
// ^^^^^^^^^ keyword.declaration.scala
// ^^ keyword.declaration.scala
// ^^^^^^^^^ - keyword.declaration.scala
// ^^ - keyword.declaration.scala
// ^ variable.parameter.scala
// ^^^^^^^^ entity.name.class
def > (y: Rational): Boolean = y < x

extension Ops on (x: Rational):
// ^^^^^^^^^ keyword.declaration.scala
// ^^^^^^^^^ - keyword.declaration.scala
// ^^^ entity.name.class
// ^^ keyword.declaration.scala
// ^^ - keyword.declaration.scala
// ^ variable.parameter.scala
// ^^^^^^^^ entity.name.class
def > (y: Rational): Boolean = y < x

extension stringOps { }
// ^^^^^^^^^ keyword.declaration.scala
// ^^^^^^^^^ entity.name.class
// ^^^^^^^^^ - keyword.declaration.scala
// ^^^^^^^^^ - entity.name.class

extension { }
// ^^^^^^^^^ keyword.declaration.scala
// ^^^^^^^^^ - keyword.declaration.scala