-
Notifications
You must be signed in to change notification settings - Fork 276
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
ScalafmtRunner: always allow top-level terms #3357
Conversation
@@ -64,7 +59,7 @@ case class ScalafmtRunner( | |||
if (null != eventCallback) evts.foreach(eventCallback) | |||
|
|||
def parse(input: meta.inputs.Input): Parsed[_ <: Tree] = | |||
getParser(input, getDialect) | |||
getParser(input, getDialect.withAllowToplevelTerms(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.
getParser(input, getDialect.withAllowToplevelTerms(true)) | |
getParser(input, getDialect.withAllowToplevelStatements(true)) |
don't we want to be most inclusive?
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.
ah, didn't realize there were two possible options...
The formatter's job is not to validate code but to format it.
@@ -28,17 +28,17 @@ case class ScalafmtRunner( | |||
fatalWarnings: Boolean = false | |||
) { | |||
@inline private[scalafmt] def getDialect = dialect.dialect | |||
private[scalafmt] lazy val getDialectForParser: Dialect = | |||
getDialect.withAllowToplevelTerms(true).withAllowToplevelStatements(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.
@tgodzik moved it here.
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.
LGTM!
The formatter's job is not to validate code but to format it.