Erlang Plugin for NetBeans in Scala#8: Pretty Formatting and Pair Matching
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:
- Pretty Formatting is implemented by ErlangFormatter.scala
- Pair Matching is implemented by ErlangKeystrokeHandler.scala
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
![(please configure the [header_logo] section in trac.ini)](/chrome/site/blog_logo.png)
rss

Comments
No comments.