Erlang Plugin for NetBeans in Scala#8: Pretty Formatting and Pair Matching

Caoyuan Blog - - February 17, 2009

Now let’s go on the complex part: Pretty Formatting and Pair Matching. I say they are complex, not because these features are much heavier on language’s semantic complex. Implementing these features mostly deals with lexer tokens. But it’s a bit brain-dried work to across forward/backward in the token stream to get the pair matching and pretty formatting working as you expected.

Because of the complex, I won’t describe the details of how to implement them for Erlang, I just put the links to these source code:

And registered them in ErlangLanguage.scala as:

 override def getKeystrokeHandler = new ErlangKeystrokeHandler override def hasFormatter = true override def getFormatter = new ErlangFormatter

With these feature implemented, the new plugin can automatically complete/match braces and pair, indent properly when you hit BREAK, input a “end” etc.

BTW, the navigator window was improved during these days, it can now properly show the arity/args of each functions. It’s done by improved AstNodeVisitor.scala and AstDfn.scala

nn



Categories: Blogs  Caoyuan Blog  

Comments

No comments so far, you could be the first.

Add comment

Name:

Email:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?