Writing an IDEA Plugin with Scala

Is it possible to write an IDEA plugin with Scala?

We are developing an external DSL in Scala and want to provide a GUI for our users. Our parser is already written in Scala, so we would want to reuse existing code for syntax highlighting etc.

So, the questions would be:
* How to setup a plugin project which uses the Scala compiler inside IntelliJ
* How to build the project outside of IntelliJ (with sbt preferably)
* Are there any problems when depending on a particular version of the Scala library?

I'll try to figure this out myself, but if someone would share prior experience I'd be glad.

Johannes

7 comments
Comment actions Permalink

You should be able to do this, in fact a fair amount of the Scala plugin is written in Scala. Ilya Sergey wrote a paper about it, get it at: http://homepages.fh-regensburg.de/~mpool/mpool08/submissions/Sergey.pdf

Let us know how you get on, I'd be interested to know since I'm thinking about doing something similar with Kawa Scheme.

0
Comment actions Permalink

Ok, first steps seem are quite promising. Let's see how it will play out, and I will report back, then.

0
Comment actions Permalink

Hey  Johannes,

I am highly interested in your project, are there any public resources? I am playing with a similar idea, I would like to use IDEA as a RCP for my sound synthesis projects (ScalaCollider & Co), so i would like to add custom views and also somehow use the existing scala plug-in to be able to have something like scratch pads (in Eclipse you have a scratchpad for Java), ideally with all the goodies like syntax highlighting, code completion etc. pp.

cheers, -sciss-

0
Comment actions Permalink

No, unfortunately, right now there are no public resources. I'm not sure if our work would help you, since we are developing a plugin for a language which has nothing to do with Scala itself. Instead we just want to use Scala for writing the IDEA plugin which so far worked well. It's like creating a Java plugin project and then putting Scala source code inside.

Since we already had a parboiled-based parser available we didn't want to to create another lexer/parser as IDEA requires it. So for now we use an ExternalAnnotator to provide syntax highlighting and basic error annotation.
In future we'll probably try to detour the lexer phase and directly generate ASTNodes from parboiled's parse tree nodes.

0
Comment actions Permalink

Hi Colin,

Your link appears to be dead now; Do you happen to know the updated URL? :)

0
Comment actions Permalink

Hi Alan,

I don't, sorry, but I put a copy online at http://colinfleming.net/Sergey.pdf, I hope Sergey doesn't mind!

Cheers,
Colin

0
Comment actions Permalink

Brilliant, thanks Colin :)

I also just found he also hosts this paper on his website http://ilyasergey.net/ - which also has a goldmine of awesome articles!

Cheers

0

Please sign in to leave a comment.