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

Debuggable async/await #156

Closed
hordon opened this issue Mar 8, 2016 · 3 comments
Closed

Debuggable async/await #156

hordon opened this issue Mar 8, 2016 · 3 comments

Comments

@hordon
Copy link

hordon commented Mar 8, 2016

All we know that code in async block cannot be debugged properly with IDE because they don't support async/await library yet. This issue can be easily fixed by creating stub library "org.scala-lang.modules" %% "scala-async-debug" % "1.0.0" that can be replaced from scala-async library when you need to debug your application. Why wouldn't provide this feature ?

The stub snippet looks very simple but can provide the ability to debug the application:

package scala.async

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}

object Async {
  def async[T](body: T)(implicit execContext: ExecutionContext) = Future(body)
  def await[T](awaitable: Future[T]) = Await.result(awaitable, Duration.Inf)
}
@retronym
Copy link
Member

retronym commented Mar 9, 2016

An alternative would be to emit such code from the regular async macro when a compiler option is provided. (-Xmacro-settings:scala.async.blocking)

@retronym
Copy link
Member

retronym commented Mar 9, 2016

BTW, IntelliJ has recently added some support in their debugger for async (evaluate expression knows that local variables in an async block might be translated to name mangled fields in a state machine class).

What specific debugging limitations are you referring to?

@retronym
Copy link
Member

I think the best answer here is to improve IntellIJ's debugger support, tracking as #136

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

No branches or pull requests

2 participants