Search code examples
scalaintellij-ideascala-ide

how to make Scala IDE/ Intelij import scala.concurrent.duration._


I am new to Scala, and many times i see code like this

implicit val timeout = Timeout(5 seconds)

with Intelij, I could press alt + enter to import Timeout. But can't for 5 seconds. Have to search google to remember the duration._


Solution

  • implicit val timeout = Timeout(5 seconds) 
    

    is actually means

    implicit val timeout = Timeout(duration.DurationInt(5).seconds) 
    

    where "DurationInt" is implicit convertion function.

    Unfortunatelly both IDEs are unable to search for implicit conversions to import. So if you want them to add import statemtn automtically try second variant.