SyntaxEditor JavaScript Completion

by Avatar Bill Henning (Actipro) - 5 comments
Thursday, February 27, 2014 at 1:09pm

PostBannerSyntaxEditorDevNotes

Last year we added an advanced JavaScript language implementation to the SyntaxEditor Web Languages Add-on.  This language implementation (available in the WPF, Silverlight, and WinRT/XAML versions of the add-on) includes features like syntax highlighting, parsing with AST generation, syntax error reporting, code outlining, etc.

In today's post I'd like to announce that we have added a simplistic completion provider to the language that should help end user coding productivity.

Completion Provider

The new completion provider displays a completion list when Ctrl+Space is pressed:

JavaScriptCompletion

The concept is similar to completion lists found in other popular IDEs like Sublime, where the list includes JavaScript keywords and identifiers found throughout the document.  The list has been set up to accept acronym and shortcut item matchers, meaning that any loosely-matched text will select items.  The list also auto-shrinks to only show matching items.

Summary

TaskDownload TaskLiveDemo TaskBuyNow

SyntaxEditor Auto-Sizing

by Avatar Bill Henning (Actipro)
Wednesday, February 26, 2014 at 2:34pm

PostBannerSyntaxEditorDevNotes

One feature that several customers have asked for is the ability for SyntaxEditor to automatically resize itself based on its text contents.  We didn't originally have this feature since it can be time-consuming (relatively speaking) and when editing huge documents, we didn't want to add any performance hits.

That being said, in the upcoming 2014.1 version of SyntaxEditor for WPF, Silverlight, and WinRT/XAML, we have added a new SyntaxEditor.IsViewLineMeasureEnabled property that can be set to true to activate view line measure behavior.  This means that you now can use SyntaxEditor in a layout scenario where its measured size will have an effect on its arranged size.

Multi-Line Editing Example

Let's check out an example of this in action.  Here we have a SyntaxEditor that has an XML language loaded and the new view line measure features enabled.  It's resizing itself vertically according to the number of lines in it:

AutoSizeMultiLine1

Now if we press Enter a couple times, it auto-sizes to a larger height:

AutoSizeMultiLine2

You can see how this would be useful when SyntaxEditor is hosted in controls like a StackPanel.

Single-Line Editing Example

We've also enhanced our single-line edit mode with a neat new feature.  Now if you set word wrap mode on and also have the view line measure features enabled, the single line will grow to render on multiple lines but will still not allow Enter to be pressed or inserted via pastes, etc.

This sort of feature is useful for scenarios where you want to allow a single line snippet of text to be edited but for the entire text to be visible.  Let's have a look:

AutoSizeSingleLine1

Above we have a SyntaxEditor in single-line mode, with word wrap on, and view line measure enabled.  Let's type some more text:

AutoSizeSingleLine2

Even though the text is still a single line (no line feeds are allowed in single-line mode), the word wrap caused the editor to grow taller.

Summary

These great new features will be available when the 2014.1 WPF, Silverlight, and WinRT/XAML versions are released in March.

TaskDownload TaskLiveDemo TaskBuyNow

SyntaxEditor Delimiter Auto-Complete Improvements

by Avatar Bill Henning (Actipro)
Tuesday, January 7, 2014 at 4:21pm

PostBannerSyntaxEditorDevNotes

Earlier last year we added delimiter auto-complete features to SyntaxEditor.  Delimiter auto-complete is where the user types a start delimiter and a related end delimiter is auto-inserted after the caret.  This is especially helpful when working on mobile tablets like a Surface since it means less overall typing is required to output the same code.  Best of all, with SyntaxEditor, these features can be easily added to any custom language.

Today I'd like to announce that we have rewritten and made improvements to the internal logic used to track delimiter auto-completions.  This means that as an end user encounters an already-completed delimiter, SyntaxEditor is more intelligent about how to handle various text change operations.

Example 1

Lets check out some of the enhancements.  We'll type in some JavaScript:

DelimiterAutoComplete1

In the screenshot above, the ) character was auto-completed when the ( character was typed.  Now let's type in some parameters:

DelimiterAutoComplete4

Next we will type the ) character even though it already exists in the document.  SyntaxEditor intelligently knows that the ) was previously auto-completed so it moves the caret past it without entering a second ):

DelimiterAutoComplete2

This sort of functionality works in the current SyntaxEditor version however only if there was nothing typed between the delimiters.  In the above scenario with the current version, since we typed in some parameter names, a second ) would have been typed.  With the most recently logic updates, SyntaxEditor now handles real-world scenarios much better.

Example 2

Let's start over to show another nice feature.  Here we've again typed a function and some parameters.  Note that the end ) was auto-completed while typing out the text so it appears after the caret.

DelimiterAutoComplete4

If we Backspace over the text and get to the start ( character, upon Backspacing over that, the related end-delimiter is automatically removed too:

DelimiterAutoComplete5

This feature works in the current version as well but again, only if there was nothing typed between the delimiters.  With the code updates, SyntaxEditor handles many more scenarios of typing within delimiters, and even multiple nestings of delimiters!

Summary

These new features will be available in the 2014.1 version of SyntaxEditor, in the WPF, WinRT/XAML, and Silverlight platforms, and will also appear in the next version of our free Code Writer Windows 8 app.

TaskDownload TaskLiveDemo TaskBuyNow

Silverlight Controls 2013.2 Build 162 Released

by Avatar Bill Henning (Actipro)
Thursday, December 19, 2013 at 9:43pm

SilverlightBlogPostBanner

Silverlight Controls 2013.2 build 162 has been released and is now available for download.  This build focuses on numerous enhancements and bug fixes.  While many updates were made, major ones are listed below.

See the announcement post for the detailed list of enhancements and updates.

ProductHeadingGenericCharts

  • Added the ability to alter the label positioning mode algorithm for a series.

ProductHeadingGenericSyntaxEditor

  • Added the ability to edit multiple lines of text at the same time when block selection is active.
  • Added incremental search features.
  • Added the ability to highlight search match results within a view.
  • Added support for alpha-blended foreground/background style colors.
  • .NET Languages Add-on - Added a 'deprecated' quick info note on types/members flagged as Obsolete.

TaskDownload TaskLiveDemo TaskBuyNow

SyntaxEditor - Search Pane Result Highlights

by Avatar Bill Henning (Actipro)
Monday, November 18, 2013 at 2:43pm

PostBannerSyntaxEditorDevNotes

In our last post, we announced that incremental search result highlights werecoming to SyntaxEditor for WPF, WinRT/XAML, and Silverlight in the next maintenance release.  These are highlights that show where each match of the incremental search text is within the document, making it easy for the end user to see the matches without having to iterate through each one.

We also are making this feature available for those who have search panes in their apps and want to be able to highlight matching results as the user enters find text in the search pane.

How It Works

Each editor view now has a new property on it named HighlightedResultSearchOptions that can be set to any ISearchOptions value.  When it is set, a worker thread searches the document for matches and highlights them.

SearchResultHighlighting

In the screenshot above, we type in a TextBox and in the TextBox.TextChanged event handler, update the value of the view's HighlightedResultSearchOptions property.  Highlights then appear for the find text matches, which is "doc" in this case.

Summary

The search result highlights help the end user quickly see where matches are without the need to cycle through them, and can be wired up to any search pane.  This feature is coming in the next maintenance release.

TaskDownload TaskLiveDemo TaskBuyNow