Scala Supporting for NetBeans Updated#1 - 20080110

Features:

  • Syntax checking, highlighting, code folding, navigator, basic indent
  • Basic completion, In-place refactoring, occurrences marks
  • Interactive Scala shell. [Windows] -> [Interactive Scala Shell]
  • Basic Scala project management with file locator for compile Errors
Notes:

  • Requires newest NetBeans Nightly build (get from: http://bits.netbeans.org/download/trunk/nightly/latest/)
  • Don't forget to set your SCALA_HOME environment first, or append "-J-Dscala.home=scalahomepath" to the end of "netbeans_default_options" in your netbeans.conf file, where, "scalahomepath" is your Scala home's absolute path. For example: /Users/dcaoyuan/apps/scala/share/scala/
    The netbeans.conf is located at "pathToNetBeansInstallationDirectory/etc", in Mac OSX, it could be:
    /Applications/NetBeans/NetBeans\ 6.0.app/Contents/Resources/NetBeans/etc

Known Issues:

  • Do not write old-style ForComprehension "for (val i <- ...)", instead, use "for(i <- ...)". Please see Scala Spec 2.6.0+
  • Do not put infix/postfix operator at the beginning of new line even in a parenthesis expression
  • When "<" is an operator, put a space after "<" to identify it from a xml element

Download:

  • http://sourceforge.net/project/showfiles.php?group_id=192439&package_id=256544

Installation:

  1. Upzip to some where, there will be several *.nbm files
  2. Run NetBeans, install these *.nbm files via [Tools] -> [Plugins] -> "Downloaded"

Comments

1. David Coldrick -- 2008-01-10 08:00

I can't get this working, and the problem appears to be in my Scala installation. I installed 2.6.1 from DarwinPorts?, and scala, scalac, etc. are all in /opt/local/bin/.

If I point SCALA_HOME to that, then try to use the plugin to build a script, I get: "Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found."

Sure enough, I have no scala tools directory anywhere. Tried to redo the install, but the result was unchanged.

Any suggestions?

Thanks, David

2. caoyuan -- 2008-01-10 08:00

If so, it may be a problem for different Scala installation directory tree.

I'll try to fix this. But before that, you may have to install a new Scala from scala's download page.

I'm thinking to wrap a default Scala installation into the package.

3. David Coldrick -- 2008-01-10 08:00

Well, I just downloaded  http://www.scala-lang.org/downloads/distrib/files/scala-2.6.1-final.tar.gz, and it doesn't appear to have any ant stuff in it.

Do I need to download source?

Thanks, David

4. caoyuan -- 2008-01-10 08:00

Need no source files, the cala/tools/ant/antlib.xml is packaged in a jar file, so just make sure scala_home pointing to the ..../scala/share/scala/ (which contains sub-dir: bin, lib etc.)

5. David Coldrick -- 2008-01-10 08:00

Just answered my own question: the antlib.xml is only in the Scala *source*.

Don't understand why this is required.

Thanks, David

6. David Coldrick -- 2008-01-10 08:00

Ah, I see. Thanks.

Regards, David

7. Caoyuan -- 2008-01-10 08:00

Ah ah, I'm a newbie to Scala, so you also answered the question for me :-)

8. David Coldrick -- 2008-01-10 08:00

It appears that I have to point to the directory you suggest (...scala/share/scala) in *both* the env variable SCALA_HOME and as a -J switch in netbeans.conf. Once I'd done that, it worked.

Thanks for your help, David

9. Howard Lovatt -- 2008-01-10 08:00

Great work and I am really interesting in trying it out.

The thing that is putting me off at the moment is that you say it needs the latest build. Are you planning to release it for NB6.0 or will I have to wait for NB6.1 before I can get your module and a stable IDE?

10. Caoyuan -- 2008-01-10 08:00

Hi David, Thanks for your information. It was also mentioned by another comment, that for Windows, all SCALA_HOME and -j option should be set properly.

Howard, I tested on NetBeans 6.0, there seems to be some issues, if these issues can be resolved, these modules should also work.

11. Aleksander Bandelj -- 2008-01-13 08:00

Plugin breaks on operators like << (it assumes << is start of XML code. See  http://scala.sygneca.com/code/simplifying-jdbc for example. Otherwise, great work.

12. Caoyuan Deng -- 2008-01-13 08:00

Hi Aleksander

Thanks for your report, I just fixed it in trunk.