-
Notifications
You must be signed in to change notification settings - Fork 37
Highlight all soft modifiers #168
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// SYNTAX TEST "source.scala" | ||
|
||
transparent inline def foo | ||
// ^^^^^^^^^^^ storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
|
||
transparent inline xdef foo | ||
// ^^^^^^^^^^^ - storage.modifier.other | ||
// ^^^^^^ - storage.modifier.other | ||
|
||
transparent inline defx foo | ||
// ^^^^^^^^^^^ - storage.modifier.other | ||
// ^^^^^^ - storage.modifier.other | ||
|
||
transparent inline final def assert | ||
// ^^^^^^^^^^^ storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
|
||
transparent badkeyword inline override def alternative | ||
// ^^^^^^^^^^^ storage.modifier.other | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to the previous comment: I don't think that we should have a test requiring that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a consequence of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be practical if we have
In this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, that's actually a quite convincing argument for keeping |
||
// ^^^^^^ storage.modifier.other | ||
|
||
transparent trait Enum extends Any with Product with Serializable | ||
// ^^^^^^^^^^^ storage.modifier.other | ||
|
||
opaque type Logarithm = Double | ||
// ^^^^^^ storage.modifier.other | ||
|
||
opaque private type Matching = Option[Tuple] | ||
// ^^^^^^ storage.modifier.other | ||
|
||
infix def + (that: Rational) = | ||
// ^^^^^ storage.modifier.other | ||
|
||
infix type +[X <: Int | String, Y <: Int | String] = (X, Y) match | ||
// ^^^^^ storage.modifier.other | ||
|
||
open class Open | ||
// ^^^^ storage.modifier.other | ||
|
||
open final class Foo1 | ||
// ^^^^ storage.modifier.other | ||
|
||
open final class Foo1 | ||
// <---- storage.modifier.other | ||
|
||
@inline def | ||
// ^^^^^^ - storage.modifier.other | ||
|
||
@infix def | ||
// ^^^^^ - storage.modifier.other | ||
|
||
@transparent def | ||
// ^^^^^^^^^^^ - storage.modifier.other | ||
|
||
@opaque def | ||
// ^^^^^^ - storage.modifier.other | ||
|
||
@open def | ||
// ^^^^ - storage.modifier.other | ||
|
||
@scala.inline def | ||
// ^^^^^^ - storage.modifier.other | ||
|
||
@infix inline def | ||
// ^^^^^ - storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
|
||
file.open() | ||
// ^^^^ - storage.modifier.other | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// SYNTAX TEST "source.scala" | ||
|
||
open class A | ||
// ^^^^ keyword.declaration.scala | ||
// ^^^^ storage.modifier.other | ||
// ^^^^^ keyword.declaration.scala | ||
// ^ entity.name.class.declaration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of allowing
[a-z\\s]*
between a soft keyword modifier and a keyword, I think we should aim to only highlight a chain of soft keywords followed by a keyword, something like((transparent|opaque|infix|open|inline)\\b)+(?=\\b(def|val|var|given|type|class|trait|object|enum))
(might need some adjustment for allowing whitespace). With soft keywords, I think we should try to be as minimal as possible, only highlighting them as keywords if strictly necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that a soft modifier can be followed by a sequence of normal modifiers.
[a-z\\s]*
skips those modifiers to find thedef|val|...
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be to list all modifiers separated by spaces instead of
[a-z\\s]*