Today I'd like to show off another new feature coming to the WPF and Silverlight .NET Languages Add-on: Visual Basic text formatting!
As mentioned in our previous post, a similar feature is being added for the C# language. Text formatters beautify code, making it more readable by adjusting whitespace.
Visual Basic Text Formatting Example
Let's see an example of some messy VB code loaded up in SyntaxEditor:
After formatting the document, the result is:
That's much nicer!
Intelligent Modifications
As described in a previous post, the best part about the text formatting feature is that SyntaxEditor only adjusts ranges it needs to. It doesn't do a mass replace of the whole document. For instance on line 23, it tweaks the leading whitespace on the line and removes the space before the end parenthesis, but doesn't touch the rest of the line.
All of the various text change operations involved in the formatting are merged into a single atomic text change that is added as a single undo stack item. This makes it easy for the end user to quickly undo any formatting changes that were made.
Summary
These features will be in the 2013.1 versions of the WPF and Silverlight SyntaxEditor .NET Languages Add-on.