All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.dotty.tools.pc.Scala3CompilerAccess.scala Maven / Gradle / Ivy

There is a newer version: 3.7.0-RC1-bin-20250116-8b27ecb-NIGHTLY
Show newest version
package dotty.tools.pc

import java.util.concurrent.ScheduledExecutorService

import scala.concurrent.ExecutionContextExecutor
import scala.meta.internal.metals.ReportContext
import scala.meta.internal.pc.CompilerAccess
import scala.meta.pc.PresentationCompilerConfig

import dotty.tools.dotc.reporting.StoreReporter
import dotty.tools.dotc.interactive.InteractiveDriver

class Scala3CompilerAccess(
    config: PresentationCompilerConfig,
    sh: Option[ScheduledExecutorService],
    newCompiler: () => Scala3CompilerWrapper
)(using ec: ExecutionContextExecutor, rc: ReportContext)
    extends CompilerAccess[StoreReporter, InteractiveDriver](
      config,
      sh,
      newCompiler,
      /* If running inside the executor, we need to reset the job queue
       * Otherwise it will block indefinetely in case of infinite loops.
       */
      shouldResetJobQueue = true
    ):

  def newReporter = new StoreReporter(null)

  /**
   * Handle the exception in order to make sure that
   * we retry immediately. Otherwise, we will wait until
   * the end of the timeout, which is 20s by default.
   */
  protected def handleSharedCompilerException(
      t: Throwable
  ): Option[String] = None

  protected def ignoreException(t: Throwable): Boolean = false
end Scala3CompilerAccess




© 2015 - 2025 Weber Informatics LLC | Privacy Policy