Skip to content

Commit

Permalink
bugfix: Remove entity.other.inherited-class.scala
Browse files Browse the repository at this point in the history
Previously, symbol in inheritance clause would be treated differently than outside it. Now, they are all treated the same.

There are three reasons for that change:
- most themes don't have a specific color for `entity.other.inherited-class.scala` and it would end up the same color as string
- there is no reason to show the same symbol with different color aside from definition/declaration
- there is no sensible way to handle `derives A, B, C` or `extends A, B, C` and the first `A` would be colored differently

Fixes #239
  • Loading branch information
tgodzik committed Sep 16, 2022
1 parent 9db075c commit 551c71c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ export const scalaTmLanguage: TmLanguage = {
name: 'keyword.declaration.scala'
},
'2': {
name: 'entity.other.inherited-class.scala'
name: 'entity.name.class'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/Scala.tmLanguage.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions tests/snap/scala_spec.test.scala.snap
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^^^^^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
# ^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
Expand Down Expand Up @@ -135,7 +135,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
> def fly(height: Int @suspendable) = ???
Expand Down Expand Up @@ -378,7 +378,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^ source.scala entity.other.inherited-class.scala
# ^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
# ^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
Expand All @@ -389,7 +389,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^ source.scala entity.other.inherited-class.scala
# ^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
# ^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
Expand Down Expand Up @@ -527,7 +527,7 @@
# ^ source.scala
# ^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.end.scala
>
Expand Down Expand Up @@ -982,11 +982,11 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^^^^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^^^^^^^^^ source.scala entity.name.class
# ^ source.scala
# ^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^^^^^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
# ^^ source.scala
Expand All @@ -998,7 +998,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^ source.scala entity.other.inherited-class.scala
# ^^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
# ^ source.scala
Expand Down Expand Up @@ -1162,7 +1162,7 @@
# ^ source.scala
# ^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^ source.scala entity.other.inherited-class.scala
# ^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala keyword.operator.comparison.scala
Expand Down Expand Up @@ -1276,7 +1276,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^ source.scala entity.other.inherited-class.scala
# ^^^^ source.scala entity.name.class
>
>trait Comparable[T <: Comparable[T]] { self: T =>
#^^^^^ source.scala keyword.declaration.scala
Expand Down Expand Up @@ -1396,7 +1396,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^ source.scala entity.other.inherited-class.scala
# ^^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
# ^ source.scala
Expand Down Expand Up @@ -1978,7 +1978,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^^^^ source.scala entity.other.inherited-class.scala
# ^^^^^^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
# ^^^^^^ source.scala entity.name.class
# ^ source.scala meta.bracket.scala
Expand Down Expand Up @@ -2376,7 +2376,7 @@
# ^ source.scala
# ^^^^^^^ source.scala keyword.declaration.scala
# ^ source.scala
# ^^^ source.scala entity.other.inherited-class.scala
# ^^^ source.scala entity.name.class
# ^ source.scala
# ^ source.scala punctuation.section.block.begin.scala
> println("Hello World")
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/#124.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,64 @@

def foo(x: A with B, c: C): Int = 0
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A with B,
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A with B:
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A:
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A,
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A'
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ punctuation.definition.character.begin.scala

class B extends A|
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A+
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A-
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A*
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A&
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends A^
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
// ^ source.scala

class B extends `A`
// ^^^^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala
// ^^^ entity.name.class
8 changes: 4 additions & 4 deletions tests/unit/#156.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
// ^^^^^ keyword.declaration.scala
// ^^^ entity.name.class.declaration
// ^^^^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala
// ^^^ entity.name.class
// ^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala
// ^^^ entity.name.class

class Foo extends Bar with
// ^^^^^ keyword.declaration.scala
// ^^^ entity.name.class.declaration
// ^^^^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala
// ^^^ entity.name.class
// ^^^^ keyword.declaration.scala


Expand Down Expand Up @@ -46,7 +46,7 @@
// ^^^ entity.name.class.declaration
// ^ entity.name.class
// ^^^^^^^ keyword.declaration.scala
// ^^ entity.other.inherited-class.scala
// ^^ entity.name.class

enum Opt[+T] derives
// ^^^^ keyword.declaration.scala
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/#77.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

class A extends B with NoStackTrace)
// ^^^^ keyword.declaration.scala
// ^^^^^^^^^^^^ entity.other.inherited-class.scala
// ^^^^^^^^^^^^ entity.name.class
// ^ meta.bracket.scala
class A extends B with NoStackTrace}
// ^^^^ keyword.declaration.scala
// ^^^^^^^^^^^^ entity.other.inherited-class.scala
// ^^^^^^^^^^^^ entity.name.class
// ^ punctuation.section.block.end.scala
class A extends B with NoStackTrace]
// ^^^^ keyword.declaration.scala
// ^^^^^^^^^^^^ entity.other.inherited-class.scala
// ^^^^^^^^^^^^ entity.name.class
// ^ meta.bracket.scala
2 changes: 1 addition & 1 deletion tests/unit/#84.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// ^^^^^^^^^^^^^^^^^^^^ string.quoted.double.scala
// ^ string.quoted.double.scala punctuation.definition.string.end.scala
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ entity.name.class
4 changes: 2 additions & 2 deletions tests/unit/enum.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// ^^^^ source.scala keyword.control.flow.scala
// ^^^^^^^^ entity.name.class
// ^^^^^^^ keyword.declaration.scala
// ^^^^^^^ entity.other.inherited-class.scala
// ^^^^^^^ entity.name.class
// ^ meta.bracket.scala
// ^ constant.numeric.scala
// ^ meta.bracket.scala
Expand All @@ -28,7 +28,7 @@
// ^^^^ source.scala keyword.control.flow.scala
// ^^^^^^^ entity.name.class
// ^^^^^^^ keyword.declaration.scala
// ^^^^^^^ entity.other.inherited-class.scala
// ^^^^^^^ entity.name.class
// ^ meta.bracket.scala
// ^ constant.numeric.scala
// ^ meta.bracket.scala

0 comments on commit 551c71c

Please sign in to comment.