Not that I know of.
> i'm interested in creating a plug-in with editor support (fancy colors,
> snippets, ...) for editing Scalate templates in Eclipse (and maybe also
> integration with the Scala IDE, JDT, ...)
Awesome! We created Scalate so it'd be fairly easy to make IDE
friendly; particularly to be able to do smart completion on the Scala
code & expressions (so an IDE would know at edit time the static
context, imports & types of everything to get awesome smart
completion); so I've been desperate for such a thing for a while :)
http://scalate.fusesource.org/documentation/user-guide.html#If_you_are_an_IDE_hacker
http://scalate.fusesource.org/creating-ide.html
but so far all we've got are TextMate bundles for syntax highlighting
(which are not perfect but OK - unfortunately no code folding in
jade/scaml).
http://scalate.fusesource.org/documentation/user-guide.html#TextMate_plugin
> in case somebody is already working on this, maybe i can contribute?
Please do!
> otherwise i can start a new project for this.
> would you guys be interested in such a plugin ?
Definitely!
For Jade/Scaml I was wondering if it'd make sense to take an already
available HAML plugin and refactor it; as mostly (at least to get 90%
of the way there) Scaml is HAML but using Scala rather than Ruby for
the code & expressions. Then Jade is pretty close to Scaml but omits
the % on element names and uses | as the first character on newlines
for text; so its hopefully a minor tweak to the grammar/lexer.
It looks like there's the Aptana Eclipse plugin for HAML/SASS
http://stackoverflow.com/questions/1474096/using-haml-sass-with-eclipse
plus there's lexers for HAML/SASS
http://www.mail-archive.com/ha...@googlegroups.com/msg01886.html
It seems the Aptana HAML support is here...
https://github.com/aptana/studio3-ruby/tree/development/plugins/com.aptana.editor.haml
not sure how easy it is to hack; but hopefully we could wire in the
Scala Eclipse Plugin to handle the Scala expressions inside
Jade/Scaml. For SSP I guess a JSP / Velocity plugin for Eclipse could
maybe be reused as a base?
We could of course use the Scalate parser to parse the templates; the
main issue though is for great IDE integration you often have to parse
bad documents and try make sense of them; so IDE's tend to use
incremental parsers using different parser technology to the actual
underlying language. e.g. In IDEA folks tend to use JFlex to parse the
text in the editor to better handle not-yet-complete files.
Another thing worth mentioning is XText for Eclipse...
http://www.eclipse.org/Xtext/
which from a parser generates a nice syntax highlighter with smart
completion with outline UI etc.
The grammars for jade/scaml/ssp are all pretty simple; so it wouldn't
be that big a deal to reimplement them on top of the underlying Antlr
mechanism in XText. All our parsers in Scalate use the Scala parser
combinators stuff (which rock!) - I did wonder if we could reuse the
existing parser combinator model and kinda introspect them to be able
to create different kinds of parsers for IDE integration; so I wonder
if we could figure out how to transform the parser combinators into
Antlr grammars that XText could use? Might be a step so far though :).
It does seem like you get so much bang for the buck with XText; that
maybe we should try create XText grammars for Scaml/Jade and SSP and
we've get a pretty decent IDE (with code folding, syntax highlighting,
outline view, warning red squiggles, completion etc) with very little
work.
If its helpful we could maybe use the underlying AST models that the
Scalate parsers use. e.g. for Scaml/Jade its the derivations of the
Statement class (expand the "Known subclasses" field on this page...)
http://scalate.fusesource.org/maven/1.5.2/scalate-core/scaladocs/index.html#org.fusesource.scalate.scaml.Statement
Or see the classes here
https://github.com/scalate/scalate/blob/master/scalate-core/src/main/scala/org/fusesource/scalate/scaml/ScamlParser.scala#L138
Here's the full scaml parser btw
https://github.com/scalate/scalate/blob/master/scalate-core/src/main/scala/org/fusesource/scalate/scaml/ScamlParser.scala#L162
Have never tried introspecting Scala Parser Combinators; so reusing
them to generate the Antlr grammar might be a little bit too hard
maybe?
What do you think? Maybe starting with XText might be easier & cleaner
and let us plugin various languages from Scalate more easily?
--
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/
Open Source Integration and Messaging
I did wonder how easy it'd be to support whitespace sensitive
languages in Xtext (Jade/Scaml) - turns out there's a sample one
available...
http://code.google.com/a/eclipselabs.org/p/todotext/
The source is here...
https://github.com/ralfebert/org.eclipselabs.todotext/tree/master/plugins/org.eclipselabs.todotext/src/org/eclipselabs/todotext
Here's how it deals with indent/dedent tokens...
https://github.com/ralfebert/org.eclipselabs.todotext/blob/master/plugins/org.eclipselabs.todotext/src/org/eclipselabs/todotext/parser/IndentTokenSource.java
So it might not be that hard to do. The parser for SSP should be much
more trivial though.
Though not sure how easy it is going to be to get full Scala
expression support; though the use of Xbase suggests it might be
possible to at least get Java-ish expressions out of the box maybe.
http://www.eclipse.org/Xtext/#xbase