-
Notifications
You must be signed in to change notification settings - Fork 233
WhitespaceTokenizer: add Granular
definition
#3907
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
Conversation
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.
I have tested this in Scalafix and I managed to get all tests relying on the historical tokeniser behavior green 👍
@@ -19,7 +19,14 @@ object WhitespaceTokenizer { | |||
def apply(input: Input, dialect: Dialect)(implicit | |||
options: Option[TokenizerOptions], | |||
tokens: java.util.Collection[Token] | |||
): WhitespaceTokenizer = new Grouping(input, dialect) | |||
): WhitespaceTokenizer = | |||
if (options.forall(_.groupWhitespace)) new Grouping(input, dialect) else new Granular |
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.
I don't mind to force custom options in Scalafix, but shouldn't Granular
be the default to preserve the <4.9.8 behavior, at least in the 4.9.x line?
if (options.forall(_.groupWhitespace)) new Grouping(input, dialect) else new Granular | |
if (exists(_.groupWhitespace)) new Grouping(input, dialect) else new Granular |
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.
done
@@ -4,6 +4,7 @@ import scala.util.DynamicVariable | |||
|
|||
final class TokenizerOptions( | |||
// options which control how tokens are emitted | |||
val groupWhitespace: Boolean = true |
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.
same question as above, could it be an opt-in rather than an opt-out?
val groupWhitespace: Boolean = true | |
val groupWhitespace: Boolean = false |
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.
done
Also, let's once again make it default, as before scalameta#3786.
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.
Tested on scalafix, tests are green out of the box, without any explicit options
Fixes #3786, as a final follow-on.