Update 3: Ruby Plugin for IDEA

Alright. Took me nearly three whole evenings to conquer IDEA. I’ve seen lots of little things I really dislike.. Globals and other BS.. Horrible..

Well. I got an initial configurable version of the “SimpleSyntax” highlighter plugin done. It’s available here as binary and source. These files will probably go away soon, after I created an official project somewhere. But some heavy cleaning up has to happen first..

Anyway, some of the nice bits of this plugin. Have a look at a configuration as it is supported right now:

[SimpleSyntax:V1.0]

Name: Ruby
Icon: simplesyntax_ruby.png
Description: Ruby Script File
ExampleCode: simplesyntax_ruby.rb

# Braces Configuration
Braces.Pairs: (),[]
Braces.Structural: {}

# Commenter Configuration
Comment.Line: #
Comment.BlockPrefix:
Comment.BlockSuffix:

# FileType Configuration
FileType.Icon: simplesyntax_ruby.png
FileType.Extensions: rb, ruby
FileType.DefaultExtension: rb

# Syntax Configuration
regex BLOCK_COMMENT                 => (?m)^(?:\s*#.*$){2,}
regex LINE_COMMENT                  => (?m)#.*$
(...)
regex SPECIAL_QUOTED_STRING         => %[qQ](.).*\1
regex SINGLE_QUOTED_STRING          => \'(?:[^\']|\\')*\'
regex DOUBLE_QUOTED_STRING          => \"(?:[^\"]|\\")*\"
(...)

# Element Descriptions
descriptions[ BLOCK_COMMENT ] = Block comment
descriptions[ LINE_COMMENT ] = Line comment
descriptions[ DOC_COMMENT ] = Documentation
(...)

# Element Default Attributes
attributes[ BLOCK_COMMENT ] = #303030,BOLD,ITALIC
attributes[ LINE_COMMENT ] = #305030,BOLD,ITALIC
attributes[ DOC_COMMENT ] = #503030,BOLD,ITALIC
(...)

I removed the dirty/incomplete parts.. :) Support for easier keyword specification, etc is still missing. For now only the “regex” rules are supported. Which is pretty clumsy for specifiying keywords..

Another “nice” thing I want to add are “ruby” and “groovy” rules in which some script code is executed to recognize tokens – instead of RegEx matching. We’ll see..

That’s it for today.. BF2 is waiting.. :)

tfdj

No comments yet. Be the first.

Leave a reply