(This document is incomplete)
This document attempts to describe the various components involved in the NetBeans Ruby IDE. It is aimed primarily for developers wanting to join the project and getting oriented.
The code lives in the Mercurial modules that contain "ruby" in their names. This also corresponds to a netbeans.org project named "ruby" which has its own bugtracking system category, its own mailing lists (for development discussion, dev@ruby.netbeans.org, for users, users@ruby.netbeans.org, for code commits, cvs@ruby.netbeans.org, and for bug/issue traffic, issues@ruby.netbeans.org).
After checking out the Mercurial repository, look for modules that begin with "ruby" (these all correspond to NetBeans modules as well).
The ruby.editing module contains the core Ruby support.
The RubyMimeTypeResolver recognizes files as Ruby files by analyzing both the extension as well as the file header for some files. This is for example where .mab files are known to be Ruby files.
The RubyLanguage and RubyTokenId classes define basic language and token attributes for Ruby.
The RubyLexer lexes Ruby sources into lexical token that are used for a wide variety of purposes. Syntax highlighting is one obvious use, but features like highlighting matching parentheses and do/end tags, automatically inserting "end" when pressing return on a line that needs it, etc. all rely on the syntax tokens.
The RubyCommentLexer lexes Ruby comments into logical tokens like "link", "html tag", "rdoc directive", and obviously "normal comment".
The RubyStringLexer lexes Ruby strings into logical tokens like "normal string" and "escaped string".
The *TokenId classes define embedding scenarios such that a String can contain Ruby code, Ruby code can contain strings and comments, etc. Arbitrarily deep nesting is allowed.
The RubyParser uses JRuby to produce an AST (abstract syntax tree) from a source. It is invoked by the IDE as necessary (e.g. when the source has been modified, or when it's first opened, etc.) and the parse tree is handed to many other operations, such as the CodeCompleter.
Most features rely both on lexing information as well as parsing information.
The CodeCompleter is invoked to produce completion results for a buffer, given an offset and a parse tree. It often also uses the syntax tokens to determine what to do. For example, it might first look at the token hierarchy under the caret and see if it's inside a regular expression, and if so, offer regexp matches instead of Ruby matches.
The BracketCompleter is perhaps poorly named; it is used to for example automatically insert a closing bracket, ], after you type an opening bracket, . And if you type the closing bracket yourself, it will figure out that it should just type through the existing closing bracket. However, it's used for a wide variety of other purposes; handling single quotes, double quotes and parentheses, automatically inserting "end" when missing", automatically reindenting lines when you for example type "end", and so on. It's really a keypress handler. The {{StructureAnalyzer}} is used to walk over an AST and extract some critical "structure" information from it. This structure is used for various purposes, such as populating the Navigator/Outline view. The {{RDocFormatter}} is used to take rdoc-formatted comments and produce HTML from them. This is used inside code completion dialogs for example. TODO - describe astOffset versus lexOffset