-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Unused import #105
Comments
One workaround I did was to add a dummy line somewhere that uses both imports: (Uses play.twirl.api.Txt and play.twirl.api.TemplateMagic.iterableToBoolean) |
Any chance for this to get fixed? Or maybe a pointer (for a person such as myself who hasn't worked with sbt plugins) where to look at in order to get this fixed? |
You can set |
Customizing the |
I was thinking: if I have I guess the suggestion is removing them all from the SBT settings and adding the import line within the templates themselves. |
This requires the default Twirl imports to be disabled because of the unused import check. See scala/bug#10270 and playframework/twirl#105
This is similar to playframework/playframework#7382 although far more painful to workaround. |
@marcospereira which import would I need to add in order to use the traditional syntax of |
This becomes even more painful when using gradle - no workaround to be found there :( |
We are also experiencing this. Any chance of a fix? |
@mckinley-olsen-oc there are some default imports made for all the templates. That is why you can use |
Hey @robinspollak not yet. Contributions would be very helpful here since this is not a priority right now. If you are using sbt, it should be possible to use silencer compiler plugin to filter code generated by twirl. |
workaround ideas:
|
@SethTisue Actually my plan for Play is to set a |
I can confirm that @SethTisue 's suggestion works on Scala 2.12.13+: scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-Xlint",
// Suggested here https://github.com/playframework/twirl/issues/105#issuecomment-782985171
"-Wconf:src=routes/.*:is,src=twirl/.*:is",
... This prints:
|
These are just workarounds, what about to add a flag to disable default imports defined in
|
For Scala 2.13.2 version and above use: For other versions of Scala use Silencer plugin: |
|
Scala 3 supports it from version 3.5.0, in lower Scala 3 versions you will get the fallowing warning:
|
I have
"-Xfatal-warnings", "-Ywarn-unused-import",
in my scalacOptionsI cannot use twirl
The text was updated successfully, but these errors were encountered: