Scala newbie: ide not properly parsing simple .scala class

Hi,
   Here is an excerpt from a scala class, with errors (according to IJ..) highlighted.  I am using the scala plugin installed yesterday, 8/24/10.

As you can see below,   the List and Array classes, as well as the "int" primitive were not recognized.  Any ideas?


  class Group(val bound: Sphere) extends Scene {

    var objs : List[Scene] = Nil


    def intersect(i: Hit, ray: Ray): Hit = {

      val l = bound.ray_sphere(ray)

      if (l >= i.lambda) return i

      var hit = i

      for (scene <- objs)

hit = scene.intersect(hit, ray)

      hit

    }

  }



  def run(n: int, level: int, ss: int) : Unit = {
    val scene = create(level, new Vec(0, -1, 0), 1)
    val out = new FileOutputStream("scalaimage.pgm")
    out.write(("P5\n"+n+" "+n+"\n255\n").getBytes())


    for { yi <- 0 to (n - 1)
          x <- 0 to (n - 1) } {
      val y = (n - 1) - yi
      var g : Double = 0
      for { dx <- 0 to (ss - 1)
            dy <- 0 to (ss - 1) } {
        val d = new Vec(x+dx*1./ss-n/2., y+dy*1./ss-n/2., n)
val ray = new Ray(new Vec(0, 0, -4), unitise(d))
        g += ray_trace(unitise(new Vec(-1, -3, 2)),
   ray, scene)
      }
      out.write((.5+255.*g/(ss*ss)).toInt);
    }
    out.close()
  }


  def main(args: Array[String]) {
    run(Integer.parseInt(args(1)),
Integer.parseInt(args(0)), 4)
  }
4 comments

when i said 'newbie', was not kidding!   so "int" is not valid in Scala: i changed to Int (I got this class from elsewhere obviously, they maybe should have tried scalac on it before posting..)

but the Array and List are still question marks - given the class does compile under scalac.

0

It looks like you have no Scala standard library in module dependencies.

To make sure that the problem have nothing to do with parsing, try to run a script like "println(List(1, 2, 3))"

Please, use this guide to configure the project.

0

Hi,
   thanks for the link: we are heading in the right direction.  I still have an issue though: the Scala Facet does not have any configuration values whatsoever: it is completely blank (see screenshot).  So i cannot configure the (manually) created scala-compiler library.

scalaFacetBlank.JPGscalaMissingCompiler.JPG

0

Hi, it appears the recent scala plugin update for 9.0.3 (dated approx 9/12/10)  has fixed this problem.  I am now able to do scala console, scalac, scala. Makes me a happy camper: I was not relishing the thought of reverting to netbeans or eclipse.

0

Please sign in to leave a comment.