RSyntaxTextArea 2.5.0 Released!

August 26th, 2013

RSyntaxTextArea 2.5.0 was just released on GitHub!  The sister libraries AutoComplete, SpellChecker, RSTAUI were updated as well.  Here’s what’s new:

  • The minimum required JRE for the libraries was bumped up to Java 5 from 1.4.  There was no hard requirement for this from a feature point of view, but it allows us to fix a few issues here and there, and modernize the code base, which is a boon for developers.
  • Improvements in both the painting code and syntax parsing code.
  • Added syntax highlighting and code folding for .htaccess files.
  • Bug fixes in JavaScript and Clojure syntax highlighting.
  • The source repositories were (obviously) moved from the old SVN repositories hosted here on fifesoft.com to GitHub.
  • A few other minor changes.

Check it out and let me know what you think!

RSyntaxTextArea repositories now on GitHub, require Java 5

August 11th, 2013

Two big things going on with RSyntaxTextArea!

First, the source for RSTA ia being moved from our personal SVN server to GitHub.  Since GitHub is the place to host open source projects these days, hopefully this new home will provide RSTA with more exposure and accessibility.  AutoComplete, SpellChecker, and the other sister libraries are moving over as well.  I haven’t quite decided yet what will happen to the current SVN server; my current idea is to keep it up and available, but to edit the readme files and Ant scripts to talk about the new location (and not actually build anything in the case of the Ant scripts, to force people to notice!).  But I can’t decide whether it’s better to just remove the repository entirely – that will force users to see it’s no longer there, causing them to go to the site and realize the source is now on Github.  While it’s a little more harsh, it will keep the project from appearing “dead” to people who simply monitor the SVN and see no updates being made.

The second big change is that, starting with the next release, RSyntaxTextArea will require Java 5.  Yes, I’m finally retiring support for Java 1.4.  If you still need to run on such an ancient JVM, you can continue to use 2.0.7 (or even fork it on Github!).  If any huge issues are found I’ll be happy to create a maintenance branch based off 2.0.7 for you Java 1.4 folks, but I seriously doubt that’ll happen.

Migrating to Java 5 doesn’t do much for the library itself, but it does modernize the code base, and fixes a couple of odd issues here and there.  You’ll find “java5″ branches in each RSTA project now; that’s where all the action is.  I’m trying to embrace git’s painless branching and all.  :)  When the work is finally done (should be in a day or two) I’ll merge these branches back into master.

Finally, I’ll be adding all known issues into the GitHub issue tracker and any other bits and pieces left remaining.  As an aside, I’ve found GitHub’s interface to be painless, fast, and intuitive.  Much better than the clunky old SourceForge interface.

.htaccess file support

July 14th, 2013

The upcoming release of RSyntaxTextArea will support syntax highlighting and code folding for .htaccess files.  This was just added in SVN commit 814.

htaccess Support

htaccess Support

RSyntaxTextArea and Java 1.4 Support

June 23rd, 2013

Does anybody really need Java 1.4 support anymore?  RSTA is one of the few remaining, active Swing libraries that supports this ancient version of Java.  It reached its EOL in 2008 (almost 5 years ago!), and even its extended support ended in February 2013.  Being a syntax highlighting text component, there hasn’t really been anything added to the JDK from Java 5 onward that would benefit it, so I’ve been keeping its minimum JRE version back at 1.4, just to keep it as “compatible” as possible.  However, there are a few drawbacks because of this:

  1. There is one API change in the JDK that occurred between Java 1.4.2 and 1.5 that affects RSTA.  The code in the repository builds cleanly when built with a true 1.4 JDK, but you will receive an error for XmlParser.java when building with Java 5+ (even if you set -source 1.4).  When building RSTA with the included Ant build scripts, you will get a big fat explanation of this spit to stdout, so you know rectify the situation if it happens to you (just add a throws-clause to a single method), but Java novices may not fully understand what’s not working.  Moving the bar up to 1.5 will clean this issue up entirely.
  2. For JavaScript code completion, RSTALanguageSupport has a dependency on Mozilla Rhino, which is developed with Java 5 but offers a 1.4-supporting version, I believe using Retroweaver.  While this is fine and dandy, and everything works, a future version of Rhino may well not include a pre-built 1.4-compliant Rhino jar, and I certainly don’t want to be in the business of building and supporting it myself.  It would be a little nicer if this nuance weren’t there.
  3. One area where the JDK does offer nice new functionality for an editor like RSTA is XML parsing.  We could add schema-based squiggle underline validation to XML files.
  4. It would be a little nice to modernize the code base.

If anyone feels strongly that we should keep releasing pre-built versions of RSTA that run on Java 1.4, please let me know, preferably in the forums.

RSyntaxTextArea – Plans for Next Release

June 9th, 2013

Because I haven’t had much time to work on RSTA lately, I’ve been thinking about making a list of work items in an attempt to get motivated.  So here’s what’s on the list so far for the next RSTA release:

  • Performance improvements, particularly for word wrap with very long lines.  This has been asked for a couple of times in the forums.  I’ve done some work, that will be available in the next SVN commit, that will improve performance to some degree.  One of RSTA’s primary issues here is that modelToView()/viewToModel() calculations are relatively expensive, and for very long word-wrapped lines, they are called literally dozens of times whenever text is inserted or the window is resized.  As a first pass, I’m refactoring things a bit so that the data used by these method calls is cached much more aggressively; this seems to improve things quite nicely.  Moving forward, I might also try to minimize the number of calls to these methods in general, though that will be a more difficult task.  There were also some performance improvements made to WrappedLineView.java in the JDK, around the Java 5 timeframe, that RSTA may be able to learn from/graciously borrow.
  • Syntax highlighting for R.
  • Syntax highlighting for .htaccess files.
  • API in AutoComplete libarary to specify the expected type of arguments in a parameterized completion.

Any other suggestions?

RSyntaxTextArea Developer Documentation Started

May 8th, 2013

Have you ever been interested in integrating syntax highlighting for your own, custom language into RSyntaxTextArea?  Now there’s finally a guide to help you do just that!

http://fifesoft.com/rsyntaxtextarea/doc/

This “developers documentation” section describes in detail how syntax highlighting is implemented in RSTA, and multiple ways that you can add your own.  In the future, it’ll have similar documentation on adding code folding, code folding, and squiggle-underline parsing.

Feedback is welcome!

 

RText 2.0.7 Released

May 7th, 2013

RText 2.0.7 was released last weekend on SourceForge!  Here’s a list of what changed:

  1. Pretty-printing now works for JSON in addition to XML and HTML.
  2. The system console plugin now auto-completes file names on pressing tab.
  3. HTML, PHP, and JSP have new option, “Automatically add closing tags for HTML tags that require them,” as well as enhanced syntax highlighting.
  4. The text editor now includes an option to use the system selection colors for selected text and its background.
  5. The file chooser and File System Tree plugin now include “Paste” option to copy/paste file lists.
  6. Added Visual Basic syntax highlighting.
  7. Various code editor fixes and performance improvements.

Happy coding!

 

RSyntaxTextArea 2.0.7 Released

April 28th, 2013

RSyntaxTextArea 2.0.7 was just released on SourceForge!  Here’s a list of the cool new stuff:

  • setBracketMatchingEnabled(boolean) now checks for brackets “to the right” of the caret if one is not found “to the left.”
  • Added API for applications to create custom hyperlinks in RSyntaxTextArea, though this API should not be considered stable.
  • Added “mark occurrences” support for XML. Currently just highlights the tag name at the current caret position and its match.
  • Fixed issue when auto-inserting spaces for tabs.
  • Major refactoring of rendering code.
  • “Traditional” selection rendering is now supported; that is, selected text can now be rendered as syntax highlighted tokens with a “selection” background (as it was previously), or as text as a single color with the “selection” background (as standard text components do). See RSyntaxTextArea.setUseSelectedTextColor(boolean).
  • Fixed performance issue in FoldingAwareIconRowHeader when it paints “active regions.”
  • Added some new token types to better differentiate markup tokens from “regular” language tokens. This allows for better syntax highlighting for stuff like HTML, JSP, and PHP.
  • JavaScript highlighting now highlights JSDoc.
  • Added Visual Basic syntax highlighting.
  • In RSTAUI, a new TextFilePropertiesDialog was added.  This dialog shows the currently edited text file’s path, size, word count, encoding, line terminator, and more.  Further, when using a TextEditorPane, you can modify the file’s encoding or line terminator directly from the dialog.
  • RSTALanguageSupport: Miscellaneous JavaScript code completion improvements (thanks Steve).
  • RSTALanguageSupport: JavaScript code now syntax highlights JSDoc.
  • RSTALanguageSupport: JavaScript code completion now offers suggestions for JSDoc when in documentation comments.
  • RSTALanguageSupport: HTML, PHP, JSP and XML now have an option to automatically add closing tags when opening tags are typed (e.g. add “</foo>” when “<foo>” is typed). By default this option is enabled. HTML, PHP and JSP only auto-close tags closeable in the HTML 5 spec; XML closes all tags. This option is separate from the XML “auto-complete closing tag name when ‘</’ is typed” option.

Below are a couple of screenshots showing off the new JSDoc syntax highlighting and code completion.  The first one shows auto-completion kicking in after typing “@” in a documentation comment.  The second screenshot shows the parameterized assistance you get for “@param”:

JSDoc Code Completion

JSDoc Code Completion

JSDoc Parameterized Completion in action

JSDoc Parameterized Completion in action

Go check it out!

Visual Basic Syntax Highlighting

March 31st, 2013

Syntax highlighting for Visual Basic was just added into SVN.  I probably won’t bother with code folding support for VB any time soon, since I don’t ever write code in it, but if you’re itching to contribute, I’m always willing to take patches!

Visual Basic Highlighting

Visual Basic Highlighting

Improved Syntax Highlighting and Theming Support

March 23rd, 2013

If you grab the latest from SVN, RSyntaxTextArea has improved theming support.  First, RSTA supports the following new token styles:

  • Markup language comments (i.e. “<!– … –>”)
  • DTDs
  • CDATA delimiters, separate from the CDATA content itself (e.g. “<![CDATA[" and "]]>”)
  • Entity references

Note that all of these are related to markup languages, such as XML, HTML, JSP and PHP.  Previously, the lexers for each of these languages identified and colorized all of these constructs, but re-used token styles for other token types when rendering them.  For example, entity references were previously rendered using the “variable” token style.  This wasn’t optimal, as it meant that theme designers had to be aware of this token-style re-use when creating custom Themes, if they wanted their Themes to be as pretty as possible.  Not so any longer!

Another new feature is that RSyntaxTextArea now supports the standard editor behavior of selected text using a different font color than unselected text.  Previously, selected text always still rendered using the proper syntax highlighting styles.  Now, this is configurable via the setUseSelectedTextColor(boolean)/getUseSelectedTextColor() API.  Theme XML can also specify how a theme wants this property set.  Below is a screenshot that compare the “dark” default theme, which has this property set to false, and the “eclipse” default theme, which has this property set to true:

Selected Text Rendering

Selected Text Rendering

Themes can also now use a special value “default” for selection foreground and background colors, which means “use the LookAndFeel’s (not system’s!) default for these values).  Check out the theme DTD for specifics.

These changes do unfortunately mean that themes created for older RSyntaxTextArea versions will no longer work with (the upcoming) 2.0.7+, as they will not pass validation against the DTD.  They can be easily updated however, so I don’t see this as much of an issue.

Finally, all of the sample themes have been updated to use the new features above.  Also, a new sample theme was added to the mix:  idea!  Thanks to Mikle Garin for this theme.  This is  obviously based off of IntelliJ IDEA‘s default theme.

IDEA Theme

IDEA Theme

Who knows, maybe a theme based off of its new Darcula will show up next.