Archive for the ‘AutoComplete’ Category

Smarter Auto-Indentation

Sunday, January 25th, 2009

The next release of RSyntaxTextArea will feature smarter auto-indentation for languages that use curly braces to denote code blocks, such as C, Java and Perl.  Instead of just remembering the previous line’s indentation, now, lines in a new code block are indented, and typing the closing ‘}’ character of a code block out-dents that character.  This is a rather small feature but most editors these days offer it, and once you get it used to it, it’s hard to go back to an editor that doesn’t have it!

Check out revision 70 in Subversion if you want to check it out early.

AutoCompletion site now up

Saturday, January 17th, 2009

AutoCompletion has enough features now where I’d really like other people to start trying out.  So I’ve added a little space for it on fifesoft.com describing what it is and (soon) how to use it. There’s a nice WebStart example there of an editor for C with code completion for the C standard library.  The Javadoc is up as well. All that is needed now is a couple of examples to get people started.

I also can’t decide if AutoComplete warrants its own SourceForge project, or if it can just be a subproject of RSyntaxTextArea. While the library can be used on any JTextComponent, auto-completion is usually used in IDE’s and programmer’s editors, and AutoComplete does come with special hooks to work better with RSTA. On the other hand, being a separate project may allow it to be discovered and used by a larger audience. Decisions, decisions…

Function Parameter Assistance

Monday, January 12th, 2009

Newly added to the AutoComplete library is parameter assistance… I’m not sure what you should actually call this feature, but it’s the one where typing a ( character causes a little tooltip to pop up describing the parameters for the function you’re entering:

param_complete1

Parameters are entered with default values. You can use tab and shift+tab to navigate through the parameters (ala Eclipse or NetBeans). The parameter you’re entering (separated by commas, for example) is highlighted in bold in the tooltip, and (if available), a short description of the currently active parameter is displayed.

This feature is configurable, just like the other autocomplete options, and can be turned off if you don’t have time to enter descriptive information about everything available to auto-complete.

I plan on making a very early release available on SourceForge this week. I’m interested in getting as much feedback as possible! As far as I know, RSTA and the AutoComplete library is the simplest way to get easy and powerful IDE-style features into Swing applications.

A minor update to RSyntaxTextArea will also be released, fixing a couple of minor bugs that have been reported by users.

AutoComplete added to Subversion

Wednesday, December 24th, 2008

I’ve gone ahead and added the AutoComplete project and its demo project to the RSyntaxTextArea Subversion repository.  Consider this to be a very early preview release.  Feedback is more than welcome, but please keep in mind that this is very much a work in progress!

AutoComplete can work on any JTextComponent.  It does not require RSyntaxTextArea.  But moving forward, it will come with built-in support for RSyntaxTextArea (it will be able to key off of its document parsing to deliver more intelligent completion choices, for example).  But feel free to use it in JTextFields or whatever else you want to use it in.

Javadoc for this early preview is here.  Check out the AutoCompleteDemo application for example usage.  The current simplest usage (just completion of simple words) is:


String[] words = new String[] { "aardvark", "angela", "apparel", "apple", "axe" };
WordCompletionProvider provider = new WordCompletionProvider(words);
AutoCompletion ac = new AutoCompletion(provider);
ac.setShowDescWindow(false);
ac.install(myTextComponent);

This will add autocompletion support for the words in the words array to myTextComponent. Simple as that. AutoCompleteDemo is a more complex example, providing autocompletion for the standard C library, complete with summaries of each method (see the screenshots below).

The code only requires Java 1.4 or greater to run, so practically everyone should be able to use it.  The license is LGPL, just like RSyntaxTextArea.

More Autocompletion progress

Tuesday, December 23rd, 2008

There’s been more autocompletion progress. It’s been mostly dirty work (making the API flexible, etc.), but there have been some cool new features added as well. First off, the rendering of autocompletion choices is now completely configurable, using standard ListCellRenderers. There will be a standard renderer that will try to nice things up a little for standard procedural and OO languages. Also, the completion and description windows are now resizable! This is a big usability improvement.

Here’s an updated screenshot of how things are looking now:

Autocompletion preview 2

Autocompletion preview 2

Autocompletion – Coming Soon!

Friday, December 19th, 2008

Here’s a little teaser…

Autocompletion Preview

Autocompletion Preview

Pretty nice huh?  It was easier to get basic autocomplete up and running in RSyntaxTextArea than I thought.  This will be an add-on library for RSTA, as not everybody will want or need this feature, and I’m trying to keep the core editor’s size down to a minimum.

It’s definitely still got some bugs and quirks, but it’s already in a usable state.  The project will get added to the RSTA Subversion repository once it’s a little more fully cooked.