Scala script: entire script mistaken as comments
hI,
I have a scala script that starts as follows:
#!/bin/bash -v
export CLASSPATH=/shared/*:$SCALA_HOME/lib/*:$CLASSPATH
echo $CLASSPATH
#$(dirname $0)/fetch-sql.scala
scala -version
exec scala -classpath $CLASSPATH $0 $@
!#
import java.util.ArrayList
import akka.actor.{Props, ActorSystem, Actor}
import collection.mutable.ListBuffer
import scala.Console
import scala.io._
import java.util.{Date, Properties}
import java.io._
import java.sql._
val dbPropsFile = if (args.length >= 1) args(0) else "/shared/classint/appannie/s3files/src/main/resources/db-classint.local.properties"
... (more code..)
The problem is that all of the code (except first two lines) is grayed out and not being parsed.
How to get scala plugin to understand, hey this is real scala code please parse it for all the code after the "!#" ?
thanks
请先登录再写评论。
I found the issue:
the ij scala parser gets confused on the CLASSPATH line:
#!/bin/bash -v
export CLASSPATH=/shared/*:$SCALA_HOME/lib/*:$CLASSPATH
It thinks it's a comment..
So to fix it, I quoted the line:
export CLASSPATH="/shared/*:$SCALA_HOME/lib/*:$CLASSPATH"
So this is a minor bug in the scala parser.
I created appropriate issue here: http://youtrack.jetbrains.com/issue/SCL-5219
Best regards,
Alexander Podkhalyuzin.