Archive for May, 2010

Integrating Language Support into RText

Saturday, May 22nd, 2010

I’ve spent the last week or so doing tedious, but important, stuff – making sure the RSTALangaugeSupport API is robust enough to be used in other applications.  The hard work is starting to pay off: Perl support is almost completely integrated already!

Perl options in RText

Perl options in RText

Here’s RText’s Options dialog, showing all the features related to Perl support that you can currently toggle.  As you can see, you can currently fiddle with both the code completion as well as the on-the-fly syntax checking I recently blogged about.  For the latter, you have to have a Perl install somewhere on your machine.  RText will scan your PATH for a Perl install, and default to using that, but you can change it to another installation if you want.  Still pending is the ability to add modules to the @INC path.

Language support will be fully integrated into all aspects of RText.  For example, compile errors and warnings will show up in the Error Strip component:

Compiler errors in Error Strip

Compiler errors in Error Strip

Also, function descriptions are displayed simply by hovering the mouse over them.  For example, below, my mouse is over the “print” function (sorry screen captures in Windows don’t capture the mouse pointer):

Function descriptions on mouse hover

Function descriptions on mouse hover

Perl is one of the harder languages to integrate, simply because its language support has so many features (runtime compilation, etc.) that others don’t have.  Hopefully other language supports will be integrated into RText shortly.  Stay tuned!

Perl Syntax Checking

Wednesday, May 12th, 2010

Perl syntax checking has been added to RSTALanguageSupport.  You can configure it with the location of a Perl install on your system (by default it scans your PATH for a Perl binary), and then PerlLanguageSupport will automatically begin scanning your code for errors as you type:

Perl Syntax Checking

Perl Syntax Checking

Next will be the ability to muck with the @INC path to add other libraries.  Currently it only uses the default @INC of your Perl install.

RSTALanguageSupport Progress

Sunday, May 2nd, 2010

The RSTALangaugeSupport library I’ve blogged about for so long has finally been added to the Subversion repository, but do note that it isn’t ready for prime time yet.  Use it at your own risk!  And send feedback when you do!  :)

If you check out the project, please read the readme file first.  It’s fairly up to date and explains how to compile and use the library.

The library currently includes code completion for the standard C library, and despite a couple of rough edges, should be mostly complete:

C code completion

C code completion

C support takes advantage of the parameter assistance feature of the AutoComplete library as well:

Parameter assistance for C functions

Parameter assistance for C functions

There’s also the start of decent support for Java, which is much more robust and dynamic than the support for other languages such as C.  It actually evaluates your code when you hit ctrl+space, and gives you accurate completion choices based on your current location in the code, based on classes you’ve imported (referencing jars on your “classpath”), local variables if you’re in a method, etc.  This has been discussed in several previous blog posts.

Java code completion

Java code completion

Yes, that tree widget on the left is actually included in RSTALanguageSupport as well!  However, it is currently Java-specific, and will not display an outline of source code in any other language.  It’s not high priority at the moment to generalize it, but it should probably happen sooner or later.  Java also supports parameter assistance when completing methods, like C does with its standard library.

There’s also code completion for Perl, supporting all built-in functions in Perl 5.10.x.  Rudimentary support for completions of variable names will appear for Perl in the next couple of days.

Perl code completion

Perl code completion

There’s also excellent support for HTML 5 – completion for all valid tag names, and attributes are suggested as well (only those attributes valid for the tag they are describing).  The description information displayed in the tool tip-style side window is rather lacking, however (as you can tell from the screenshot), so help improving this documentation is more than welcome!

HTML Completion

HTML Completion

PHP code completion is also included.  It uses the built-in HTML support when editing HTML, but when the caret is within PHP tags, PHP functions are suggested instead.  There is no documentation for PHP functions in the description window like there is for other languages just yet.

PHP code completion

PHP code completion

Similar to the C and Java support, parameter assistance is included for PHP functions:

Parameter assistance for PHP

Parameter assistance for PHP

Hopefully that is enough to whet some appetites!  Please discuss and ask questions over in the forums.