Consider the code below.
Is it possible to make InteliJ to automatically refactor each wildcard import into explicit imports (whatever is used in scope)?
For example import scalatags.JsDom.all._
into import scalatags.JsDom.all.{ol,li,div}
?
My search suggests that it is not possible, but maybe I am wrong?
This is a related but different question.
package app.client
import app.client.components.RootReactComp
import app.client.pages.spatutorial.components.GlobalStyles
import japgolly.scalajs.react.ReactDOM
import org.scalajs.dom
import org.scalajs.dom.raw.Element
import scala.scalajs.js
import scala.scalajs.js.annotation.JSExport
import scalacss.Defaults._
import scalatags.JsDom.all._
import scalatags.JsDom.implicits._
import scalatags.JsDom.svgAttrs.{fill, height, points, stroke, width,strokeWidth}
import scalatags.JsDom.svgTags._
@JSExport("Main")
object Main extends js.JSApp {
@JSExport
def main(): Unit = {
// log.warn("Application starting")
// // send log messages also to the server
// log.enableServerLogging("/logging")
// log.info("This message goes to server as well")
// create stylesheet
GlobalStyles.addToDocument()
// tell React to render the router in the document body
//ReactDOM.render(router(), dom.document.getElementById("root"))
ReactDOM.render(RootReactComp.themedView(), dom.document.getElementById("joco"))
val el: Element =dom.document.getElementById("svg-example")
val l= div( ol(
li("Ordered List Item 1"),
li("Ordered List Item 2"),
li("Ordered List Item 3")
)).render
val s= svg(height := "800", width := "500")(
polyline(
points := "20,20 40,25 60,40 80,120 120,140 200,180",
fill := "none",
stroke := "black",
strokeWidth := "3"
)
)
el.appendChild(l);
}
Open Dialog
Preferences > Editor > Code Style > Scala
Select tab Imports
In the field "Class count to use import with _", enter a ridiculously high number, e.g. 5000.
From now on, the "Optimize Imports" command will resolve wildcards to individual imports.
You probably also want to activate
Editor > General > Auto Import > Scala > Optimize Imports on the Fly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With