8

How can I add debug points to statements in for-comprehension?

for {
  a <- sqlQuery1()
  b <- sqlQuery2()
} yield {
  // output
}

I want to inspect as each of the above queries are executed, but simply adding debug points does not seem to work. The queries get executed without ever hitting debug points. I am not sure if it is a limitation of the library being used, language or IDE.

Here is my setup:

  • Scala
  • IntelliJ IDEA 14.1.3
  • Scala Plugin 1.5.200
  • Library - Slick 3.0 (Using DBIO Actions)

Update:

Case 1: with slick

Debug points don't work. Confirmed that again.

Case 2: w/o slick

Debugger does stop at debug points. But sometimes it evaluates expressions and sometimes it does not. I have noticed following problems (in currying / anonymous functions):

  1. Variable value is shown as 'Size = ?'
  2. Variable value is 'Debug info unavailable'
  3. Fails to evaluate expression
  4. Cursor stays on the same line without highlighting anything whenever I step over (it is doing things in the background though)
  5. 'Warning: No executable code found at...'

Actually searching without slick as keyword showed me that a lot of people have similar issues, like here.

Community
  • 1
  • 1
panther
  • 767
  • 5
  • 21
  • Works for me; I have the same Intellij setup. –  Sep 13 '15 at 20:51
  • @I.K. Are you using slick with for-comprehension? I am not sure, but I think it might be playing a role here then. It uses [reactive streams](http://www.typesafe.com/activator/template/akka-stream-scala). – panther Sep 14 '15 at 17:28
  • I am able to set break points inside the `for`-comprehension. When I run the debugger it does stop inside and then I use the Intellij force into feature to go inside the code that is inside the `for`-comprehension. –  Sep 14 '15 at 19:11
  • Added more info based on your update. – panther Sep 28 '15 at 20:48

0 Answers0