From ccf7f8ae4e09c1e5cbbc52d64ff0358203d29d5c Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 2 Dec 2015 16:26:12 +0100 Subject: Add initial CompilerCallback implementation for IntelliJ This adds some simple callbacks to Dotty that should be enough to get basic integration from IntelliJ. --- src/dotty/tools/dotc/Driver.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/Driver.scala') diff --git a/src/dotty/tools/dotc/Driver.scala b/src/dotty/tools/dotc/Driver.scala index 22170a478..1627b6e48 100644 --- a/src/dotty/tools/dotc/Driver.scala +++ b/src/dotty/tools/dotc/Driver.scala @@ -34,7 +34,10 @@ abstract class Driver extends DotClass { def setup(args: Array[String], rootCtx: Context): (List[String], Context) = { val summary = CompilerCommand.distill(args)(rootCtx) - implicit val ctx: Context = initCtx.fresh.setSettings(summary.sstate) + // FIXME: We should reuse rootCtx instead of creating newCtx, but this + // makes some tests fail with "denotation module _root_ invalid in run 2." + val newCtx = initCtx.setCompilerCallback(rootCtx.compilerCallback) + implicit val ctx: Context = newCtx.fresh.setSettings(summary.sstate) val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired) (fileNames, ctx) } @@ -44,6 +47,10 @@ abstract class Driver extends DotClass { doCompile(newCompiler(), fileNames)(ctx) } + def process(args: Array[String], callback: CompilerCallback): Reporter = { + process(args, initCtx.setCompilerCallback(callback)) + } + // We overload `process` instead of using a default argument so that we // can easily call this method using reflection from `RawCompiler` in sbt. def process(args: Array[String]): Reporter = { -- cgit v1.2.3