Skip to content
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

Update scala-debug-adpater to 4.x and add support for hot code replace #2276

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

adpi2
Copy link
Member

@adpi2 adpi2 commented Feb 19, 2024

The new 4.x version of the scala-debug-adpater brings:

  • pretty stack traces
  • runtime evaluator (scalameta-based evaluation on runtime values)
  • hot code replace

See the release notes for more information.

For the hot code replace we need Bloop to call the onClassUpdate callback each time some classes change or new classes are created. This PR implements it by introducing the ClientClassesObserver. It compares the new CompileAnalysis with the previous one to know which classes need to be reloaded and then it calls the onClassUpdate callback.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 Love all the new improvements here!

private val previousAnalysis: AtomicReference[CompileAnalysis] = new AtomicReference()
private val classesSubject: PublishSubject[Seq[String]] = PublishSubject()

def observable: Observable[Seq[String]] = classesSubject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that worries me is that we will want to replace monix at some point. Do you know if there is a cats effect equivalent that we can use?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know for cats-effect but there is a reactivex equivalent and it already is a transitive dependency of Bloop brought by the scala-debug-adapter. Also I saw some other usages of monix obersvable/observers elsewhere in Bloop.

@adpi2 adpi2 merged commit 30bbb86 into scalacenter:main Feb 19, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants