The code completion library for standard programming languages for RSyntaxTextArea is almost ready for a public repository. I plan on calling this library “RSTALanguageSupport” (nice name, huh?), as it contains support for editing common programming languages with RSyntaxTextArea.
In getting this library tidied up, I’ve picked up the Java code completion yet again, since it’s by far the most complex. I thought I’d give a status update now so people don’t have unrealistic expectations about the library when it’s first released.
Assuming you’ve added any jars you want on your “build path” (to use Eclipse terminology), the Java code completion support can handle:
- Class fields and methods:
- Local variables in scope in the current method:
- Methods and static fields of non-primitive fields and local variables:
- Common Javadoc completions that I personally find extremely useful in Eclipse:
It does not currently handle completions for return types of methods:
This is the single issue that will take the longest to resolve, as it’ll take a re-hashing of how the code completion is parsing the code. Other features and bug fixes will appear before this one is fixed.
Also, please note that the Java code completion should not be considered “good design.” I am (poorly) self-taught in lexing/parsing, and so what I have now is certainly not optimized, easy to read, or using the latest design techniques. It is what it is. I consider this to be a learning experience, and that the library will improve over time.
That said, it seems reasonably performant (only a pause when it has to initially load completions for many new classes, such as multiple imports of large packages, such as “javax.swing.*”), and is more than usable on the machines I’ve tested on. Memory usage could certainly be improved (stuff isn’t shared between multiple editors implementing Java completion that should be) but I plan to fix that soon.
As a side note – as you can see from the first screenshot, I’m also working on tying Javadoc into the description window. Notice that the Javadoc for the “str” field is nicely formatted in the tool tip-style side window? That happens for all fields and methods in the current source file. I’m also working on the ability to add “source attachments” for jars on the “classpath,” just like Eclipse, which will be used for assistance with libraries. So for example, you can point to the src.zip included with your JDK, and get a nice description of each class, field and method in the JDK, just like in your favorite real IDE!
Integration of this library into RText as a plugin is already underway. As always, RText will be a showcase of all the cool stuff you can do with RSyntaxTextArea.