Skip to content

Commit c13f8de

Browse files
authored
Kill and make sure that the presentation compiler is interrupted before starting a new thread (#1272)
fixes #1229
1 parent 37a29f4 commit c13f8de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scalafix-rules/src/main/scala/scala/tools/nsc/interactive/ScalafixGlobalProxy.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package scala.tools.nsc.interactive
22

33
import java.util.logging.Level
44

5+
import scala.tools.nsc.util.WorkScheduler
56
import scala.util.control.NonFatal
67

78
import scala.meta.internal.pc.ScalafixGlobal
@@ -29,8 +30,8 @@ trait ScalafixGlobalProxy { this: ScalafixGlobal =>
2930
private def newRunnerThread(): Thread = {
3031
if (compileRunner.isAlive) {
3132
try {
32-
val re = askForResponse(() => throw ShutdownReq)
33-
re.get
33+
this.askShutdown()
34+
while (compileRunner.isAlive) Thread.sleep(0)
3435
} catch {
3536
case NonFatal(e) =>
3637
println(
@@ -40,6 +41,7 @@ trait ScalafixGlobalProxy { this: ScalafixGlobal =>
4041
)
4142
}
4243
}
44+
this.scheduler = new WorkScheduler
4345
compileRunner = new ScalafixGlobalThread(this, "Metals")
4446
compileRunner.setDaemon(true)
4547
compileRunner.start()

0 commit comments

Comments
 (0)