在使用Scala进行开发时,如何防止调试器在Eclipse中踩入Object类代码?

时间:2013-05-17 13:42:21

标签: eclipse debugging scala scala-2.10 scala-ide

在我的档案file.scala中,我有以下一行:

  `file.scala`
    > shapes.foreach({ shape =>
     ...

当我开始使用Eclipse 3.7,scala插件版本2.1.0mp3调试它时,我按F5输入代码。它按顺序将我带到以下文件:

  `AbstractFunction1.class`
    > abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, ..
  `Object.class`
      Source code is not found
  `AbstractFunction1.class`
    > abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, ..
  `Function1.class`
    >  trait Function1[@specialized(scala.Int, scala.Long, ...
  `AbstractFunction1.class`
    > abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, ..
  `file.scala`
    > shapes.foreach({ shape =>
  `file.scala`
    > shapes.foreach({ shape =>

然后它最终显示带有while循环的foreach方法的主体,尚未进入file.scala中描述的那个。

但是我按F5 7次只是为了进入一个foreach循环。我怎么能做得更好?是否可以指定要自动跳过的文件?

1 个答案:

答案 0 :(得分:3)

首先,请update your Scala IDE to the latest stable release,即撰写本文时的v3.0.0。

然后,您将很高兴知道Scala IDE提供了一个新的Scala调试器,它专门针对Scala代码进行了调整。例如,单步执行map / foreach / ...将按预期工作,即,您将进入闭包内部而不会被重定向到您提到的类中。有关详细信息和Scala Debugger documentation,请查看don't miss the screencast