-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for xsbti.compile.CompileProgress #18739
Conversation
@@ -400,7 +460,101 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint | |||
} | |||
|
|||
object Run { | |||
|
|||
class SubPhases(val phase: Phase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this exists is because TyperPhase
is really like three phases, it might be good to allow cancellation in the middle of the phase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason not to split TyperPhase
into three phases?
95090c0
to
4ccba38
Compare
updated with cancellation support |
Test that the callbacks are called with expected values
also add sbt-bridge test for CompileProgress
If you want to see this working in action, check out https://github.com/bishabosha/spire-scala3, set the scalaVersion to |
compiler/src/dotty/tools/dotc/sbt/interfaces/ProgressCallback.java
Outdated
Show resolved
Hide resolved
/** Keep synchronised with `monitor` subcalls */ | ||
override def subPhases: List[String] = List("indexing", "typechecking", "checking java") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want that "keep synchronized" comment to be actually upheld, you should also put a similar comments at all the places that actually do call monitor
. Otherwise someone changing the call sites will never see this comment and hence will never update subPhases
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the strings into context parameters, and refactored the way we tick the subphase so its actually more declarative
517c3fe
to
9eeafdf
Compare
9eeafdf
to
51abd42
Compare
This is great! Should we backport this to LTS? |
Edit 2: we should backport, to clear confusion - note we do change the sbt-bridge so IntelliJ will need to be notified |
Backports #18739 to the LTS branch. PR submitted by the release tooling. [skip ci]
so far only the progress tracking, I intend to add in support for cancellation as wellEdit: now supports cancellation and progress tracking.
I am testing cancellation in a synchronous way, should I test in another way (thread interruptions)?
fixes #13082
Release Notes
Scala 3.4 restores support for progress tracking (available in Scala 2), this also provides an interface for cooperative interruption of compilation (e.g. cancellation from within an editor). Metals IDE users will notice that compilation progress is no longer frozen at 0% when using sbt or bloop as the BSP server. IntelliJ will also correctly report progress for BSP and sbt based projects