RText 1.1.0 Released!

March 16th, 2010

Hot on the heels of the latest release of RSTA comes a new release of RText.  This time around we have both new features as well as bug fixes and “platform” enhancements (too bad nobody uses the platform except RText!).

The coolest new feature is “Tool support.”  You can now set up “external tools” (e.g. other programs on your system and run them from inside RText.  This allows you to more easily integrate with compilers, tools such as Ant, or any other program you use regularly while programming.  You can even assign keyboard shortcuts to tools, to allow for easy execution.

Adding a New Tool

Below are example screenshots showing a simple Java program being executed within RText:

Selecting a Tool to run

Running a compiled Java class

Task support has been enhanced as well.  In 1.0, any time “TODO” or “FIXME” was found in a code comment, it was assumed to be a task.  Now, users can define what tokens constitute a task themselves.  This allows you to tailor RText to handle your own personal little programming quirks.

Adding a new Task Identifier

All of the enhancements previously blogged about for RSTA also show up in RText 1.1.  This means nice little things such as improved keyboard navigation, and better font selection out-of-the-box on OS X.

Finally, as always, lots of little bugs were squashed and tiny usability enhancements made.  Again, most enhancements these days comes from suggestions from users, so speak up if there’s something you’d like to see in RText or RSyntaxTextArea!  A good place to be heard is over in the forums.

So give this release a shot and see what you think!  The next release will likely sport the currently-vaporware code completion I’ve been working on for a few languages, so stay tuned…

RSyntaxTextArea 1.4.1 Released

March 12th, 2010

We’re proud to announce that RSyntaxTextArea 1.4.1 has been released!  This release touches the text component, as well as the AutoComplete and SpellChecker libraries.  It is mainly a bug fix/usability release, with relatively minor new features.  Here’s a recap of what’s new:

  1. Made the default font be Monaco on OS X 10.4/10.5, and Menlo on Snow Leopard.
  2. Syntax schemes are now smarter and automatically pick up on when you change the base font of the editor, adjusting themselves accordingly.
  3. Better cursor navigation with Ctrl+left/right arrows (now behaves like
    Eclipse). Also improved word selection via double-clicking behavior.
  4. Added method to toggle whether an EOL marker is painted for each line.
  5. New keymapping: shift+space does a “dumb complete word” action where the last word in the document that matches the “word” up to the caret position
    is auto-completed. Keep pressing shift+space to go back further in the
    document. Again, this is mimicking Eclipse’s action (that has no default key mapping).
  6. You can now configure what constitutes a “task” identifier for TaskTagParser.
  7. Improved XML auto-closing tags (accepts ‘:’ and ‘-’ chars in tag names, as it always should have).
  8. Fixed an exception when spell checking plain text files (no syntax highlighting)

The keyboard navigation updates and shift+space are my personal favorite changes.  They’re excellent if you’re really keyboard/shortcut heavy and not a mouse user.  And the OS X font changes keep things looking as nice and “native” as possible out-of-the-box on that platform.

The AutoComplete library‘s version number was bumped from 0.4 to 1.4.1 so that it coincides with RSTA itself (just like SpellChecker).  This is to help facilitate the “use the version of the add-on library that is closest to your version of RSyntaxTextArea” idea.

Go grab it today and see what you think!

Yet more Improvements to RSyntaxTextArea

January 10th, 2010

Happy New Year!  After a nice long break, it’s time to get the ball rolling on the Fifesoft projects again!

First, some low-lying fruit has been picked for RSTA.  You can now toggle whether end-of-line markers are rendered at the end of each line.  This can be useful for things such as seeing extra whitespace at the end of lines.  Here’s a preview of this feature being used in RText, where it is already integrated in SVN:

EOL Markers in RSyntaxTextArea

EOL Markers in RSyntaxTextArea

Also, and perhaps more importantly, there have been improvements in RSTA’s keyboard navigation.  Ctrl+left/right arrow have always skipped words, but until now, it’s used Java’s default “word skip” behavior (e.g. BreakIterator.getWordInstance()).  This isn’t really optimal for skipping “words” in source code, so this functionality has been revamped to behave like Eclipse does.  The only difference is that the caret does not stop at capital letters in camelCaseIdentifiers.  I despise this behavior, and I don’t know why the Eclipse devs think it’s a good idea.  Besides this, double-clicking on a word does a better “select word” for source code than before.  These are little things that make a big usability difference.

Finally, external tool support is being added into RText.  This will allow you to run things such as Ant, compilers, or whatever else from directly inside RText.  Nothing really to show at the moment though, just the framework has been put in.

Java Field and Local Variable Completion

December 10th, 2009

The Java code completion I’m working on has hit a new milestone.  Code completion for fields and local variables is starting to work:

Field Completion

Field Completion

RText 1.0.0 Released!

December 5th, 2009

It’s been a very long time coming, but RText 1.0 has finally been released!  Since it’s been production quality for awhile now (I’ve used it at work, across multiple OS’s, for years now), I decided to give it the credit it deserves.

Cool stuff in the 1.0 release include:

  • Cleaned up the main window – removed some unnecessary borders around components (Swing is bad at that sort of thing), and modernized the appearance of “dockable windows” (the windows the plugins live in).
  • Updated to the latest RSyntaxTextArea release.  This brings highlighting support for Scala, Delphi and BBCode, auto-insertion of closing curly braces in C-style languages, auto-completion of closing tags in XML, and a default color scheme that’s easier on the eyes for markup languages.
  • A spell checker was added.  It uses Jazzy and supports American and British English out-of-the-box.  Spelling errors are squiggle-underlined, and a focusable tool tip allows the user to correct the spelling error, add the word to a user dictionary, or ignore the word (just like in Eclipse).  I’m particularly proud of this new feature.
  • An optional “Tasks” window displays all instances of “TODO” and “FIXME” in your code comments for all opened files, like in Eclipse.
  • The file chooser now lets you open files in the system default viewer or editor via RMB -> Open In… -> System Viewer/Editor.  This feature requires Java 6.
  • Improved the “Split Window” view.  While the default is the Tabbed View, “Split Window” is probably the second-most popular view in RText.  The file list is now a real “dockable window” so it integrates into the rest of the UI like it’s supposed to now.  It also now has a context menu for the files in it (save, close, file properties, etc.).
  • Big code reorganization that doesn’t really show in the application itself, but hopefully makes the source a little better organized.

There’s plenty to do for 1.1, not the least of which is to bring some of the localizations back up to date (they really fell behind with this release).  I also plan to add “External Tool” support – assign a keyboard shortcut to your favorite application!

Give it a try and see what you think!  Feedback, criticism, and everything else is welcome in the forums.

RSyntaxTextArea 1.4.0 Released! SpellChecker Too!

December 2nd, 2009

Both RSyntaxTextArea and SpellChecker 1.4.0 were just released on SourceForge!  Go grab them and try them out!  A lot of new features and bug fixes have gone into the library with this release.  Spell checking alone has been an oft-requested feature, but there’s lots more than that:

  • “FocusableTips” were added, which are tool tips that become focusable when the
    user clicks on them or presses F2, like the tool tips in Eclipse.  These
    are the default tool tips for RSyntaxTextArea, and can be used by parsers
    (such as the spell checker) for user-friendly assistance.
  • Added an “Error Strip” component, designed to sit on the right-hand side of an RSyntaxTextArea.  Also seen in Eclipse and NetBeans, this component is capable of displaying colored markers for various stuff in the editor – parser errors, marked occurrences of the currently selected identifier, etc.
  • Delphi, Scala and BBCode syntax highlighting were added.
  • RSTA will now automatically insert a closing curly brace when appropriate for C, C++, C#, Java and Perl.  This behavior is toggle-able in the API if you don’t like or want it.
  • RSTA will also now automatically complete closing XML tags when “</” is typed (again, you can turn this off if you don’t want it, but it’s really nice!).
  • Various bug fixes and improvements.
  • The spell checker library is now officially released.  It’s version is “1.4.0″ to indicate that it should only be used with RSyntaxTextArea 1.4.0, not earlier releases.  It comes with a simple demo app showing how easy it is to use it with RSTA.
  • RSTA comes with a “Task Parser” as well.  It scans source code for the tokens “TODO” and “FIXME” in comments.  Applications can use this parser to provide the user with a list of “tasks” they’ve reminded themselves of in code.

Now that the release is done, I plan on updating the RSyntaxTextArea site with documentation on how to use these cool new features.

Also coming up shortly, a new RText version should be released that will take full advantage of all of these new features!

Java Code Completion

November 15th, 2009

To ensure the robustness of the AutoComplete library, I decided to see what it would take to implement some basic Java code completion.  This is of course much more complex than completion for markup languages, and presents a different set of challenges, but it’s something I’ve always been interested in.

The first thing that I needed was a Java parser, one that could break a source file down into an AST suitable for code completion.  This means you don’t have to go as far as parsing actual method bodies, you just have to grab imports, class/interface/enum names, method and field names, and local variables.  Of course, this isn’t a trivial task by any means; especially for local variables, you have to parse method bodies “well enough” to be able to get the variable names and types, without getting caught up in validating the method body’s structure.

Luckily, I had already been working on such a beast off and on (yes, I’m a geek) so I had something to go on.  It can currently parse all source files in the 1.6u16 JDK (well, classes and interfaces, I’ve put off enums for now to work on other areas), so I think it’s in pretty good shape.  Its error recovery (ability to keep parsing after seeing invalid Java source) is pretty terrible, mostly due to my lack of real education in parsing/compiler design.

So with the Java parser at least functional, the next step was to integrate it into RSyntaxTextArea’s Parser API.  That way the parser runs whenever the text component’s document is modified, allowing the user to get up-to-date completion choices automatically.  This part was easy, as RSTA’s Parser API was already up to the job.

Here’s what’s included in completion suggestions so far:

  • Field and method names for members of the class being edited.
  • Field and method names for all super classes and implemented interfaces.  Access flags are honored – e.g. you will not see suggestions for private members of extended classes.
  • Local variable names for variables accessible at the current caret position.
  • Names of imported classes (e.g. “import java.io.*;” allows everything in the java.io package to be suggested).  Again, access flags are honored – package private classes, etc. are not suggested (unless the source being parsed is part of that package).
  • Anything fully-qualified is suggested as well, so typing “com.sun.java.swing.<ctrl+space>” will suggest everything in that package, whether you’ve imported it or not.
Java Code Completion

Local Variable Completion

Completion of a local (marked deprecated) method

Completion of a local (marked deprecated) method

Handling Fully-Qualified Class Names

Handling Fully-Qualified Class Names

Of course, this is no Eclipse (yet!), so there’s plenty of issues to work out:

  • It can be slow when loading classes from imports of large packages the first time(e.g. importing java.util.*, java.io.*, javax.swing.* all together).  Once the classes are loaded, code completion is fast, it’s just the initial caching that can take some time.  This is because this package actually parses the completion info out of the jar (e.g. scans the .class files in a tools.jar), which can take some time.  We should be smart and load this stuff off the EDT when possible (e.g. when the user adds the import, but before they hit ctrl+space).
  • It does not yet offer available methods for local variables or members.  For example, for the local variable “String str”, typing “str.get<ctr+space>” will not return “getBytes()”.  The parser does know that “str” is a String however, so this functionality is on the to-do list.  This could get very complicated however, with situations such as chained methods.
  • Javadoc is not served up with the completion choices.  This can also be added, but probably won’t be seriously looked at until other issues are sorted out first.  Expect to see Javadoc returned for members in the being-parsed source before general purpose, src.zip-style documentation support.

Markup Language Enhancements in RSTA

October 13th, 2009

I decided to give the markup languages (XML, HTML, JSP and PHP) a little love  in RSyntaxTextArea.  Their syntax is so structured it should be easier to support more advanced features with them than with more abstract languages.

The first thing I did was “soften” the default color scheme used for markup languages.  Here’s how an HTML file looks out-of-the-box now:

Softer color scheme

Softer color scheme

Note that element names are now differentiated from attributes.  I may end up softening the string color as well, as that’s still a little obnoxious.

With things looking nicer, I decided to implement a new time-saving feature.  Now, typing “</” in an XML file will automatically complete the closing tag with the correct tag name.  e.g. typing:

<foo></

will type the following into the editor:

<foo></foo>

A welcome time-saver.  This feature can also be toggled on with HTML, JSP and PHP, but by default it is off, due to HTML often accepting unclosed tags such as <p>, <hr>, etc., which would mess up close-tag completions.

Going one step further from completing closing tags, I also used the AutoComplete library to add auto-completion for HTML, JSP and PHP.  The completion is very smart:

  • It only offers tag names as suggestions when you’re at the start of a tag (e.g. “<” or “<ht”).
  • If you’ve already typed a tag name, only the attributes valid for that tag will be offered as completion choices until the tag is closed.
  • No completion choices are offered if it doesn’t make sense (you’re in a comment, a string literal, in embedded JavaScript, etc.).
Auto-completing an HTML tag

Auto-completing an HTML tag

Intelligent attribute completion

Intelligent attribute completion

HTML/JSP/PHP code completion will definitely be integrated into the next RText release, but I’d like to figure out a way to release it alongside the standard AutoComplete library.  I don’t think it should be a part of the main library itself (why bloat the library with completion support for a language that might not be needed by all users?), but perhaps some kind of additional jar, that includes pre-built support for certain languages such as this?

If anybody would like to help filling in the gaps in the description for HTML tags and their attributes for this HTML code completion, get in contact with me.  I scraped some basic info off the web, but it’s really lacking.  You would of course receive credit for your input.

Breadcrumb Bar Nearly Done

October 4th, 2009

The breadcrumb bar I blogged about earlier is nearly done.  I managed to mimic the behavior seen in Vista’s breadcrumb bars, clicking outside of the “button” area turns the breadcrumb bar into a text field for manually typing a file path.  Even better, it offers suggestions as you type!  Here’s how it’s looking in RText’s file chooser dialog:

Using the Breadcrumb Bar

Using the Breadcrumb Bar

Morphing into text field with autocomplete

Morphing into text field with autocomplete

This is much more powerful than the combo box with the directory hierarchy that was there previously.  Note that if too many folders are in a directory to be listed in a single menu, there are arrows at the top and bottom of the menu, allowing you to scroll through the entire list.  The menu also responds to the scroll wheel on the mouse.  I’ve seen this behavior on OS X, on a Macbook where screen space is limited (or you just don’t want a menu to get too long).

This component should honor RTL locales, as well as look good in all LookAndFeels (tested in all the standard ones, including Nimbus, which, as always, took a little work to get looking good).  As always, check it out from RText’s Subversion repository if you want to see how it is implemented.

TokenMakerMaker Beta available for testing!

September 26th, 2009

Though development has unfortunately come to a crawl, a first beta of TokenMakerMaker is available for testing.  Contact me if you’re interested in testing it out.  It will be a feedback-driven project – features that are asked for are what will be implemented.  I plan on using it to generate a few new scanners for the next version of RSTA – first will be ActionScript.