-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support shebang in .scala files with the Scala 3 dialect #3267
Comments
according to the blog below, there's no good solution: https://www.codementor.io/@martinbrosenberg/shello-world-writing-a-scala-script-z8qg4i7d4 |
This bug report is about the fact that Scala 3 supports shebang lines in source files (in the sense that they are just ignored by the compiler), but scalafmt does not, thus is unable to format such Scala source files even though they are accepted by the compiler. The blog is about the issue that not all all tools support shebang lines for Scala 2. |
please include a link to documentation. I'd prefer not to revisit this issue if it turns out that such scripts are handled even more permissively. for instance, the blog seems to suggest that scripts don't require a top level object or class (which is not the same as simply ignoring). |
Configuration (required)
Steps
Given code like this:
Problem
Scalafmt formats code like this:
Expectation
The file is legal scala3 (can be run with
scala main.scala
and compiled withscalac main.scala
), and should be formatted while ignoring the first line.Notes
There seems to be supported for ammonite scripts, or rather anything with a
.sc
file endingThe text was updated successfully, but these errors were encountered: