|
|
by Bill Henning (Actipro)
September 2, 2010 at 03:29
The 2010.2 version of SyntaxEditor for WPF (and the same for the 2010.2 Silverlight Studio release) will get a new built-in language service called SquiggleTagQuickInfoProvider that you can register on your language. When this service is registered and the mouse is moved over a squiggle, it checks the squiggle data to see if there is related content available that can be displayed in an IntelliPrompt popup. If so, it displays it. Here’s and example of quick info for a parse error:  In this sample, we’re using the Web Languages Add-on’s XML language. The XML parser returned that there was a parse error because there is an unexpected duplicate end tag. We already have a built-in tagger that automatically looks for parse errors from a parser and makes squiggle lines in the editor for them. Now with this new quick info provider, mouse hovers over the squiggles will also show the text of the parse error. If you have a parser on your language that is capable of returning parse errors, then it just takes two lines of code to register the parse error tagger (which renders the squiggles) and the new squiggle tag quick info provider, thereby giving you all this functionality.
by Bill Henning (Actipro)
August 31, 2010 at 06:14
As mentioned in one of our previous posts, we’ve been working on a port of our SyntaxEditor Web Languages Add-on from WinForms to the WPF version of SyntaxEditor. We’re finishing up some last features on it before it will be ready to launch alongside WPF Studio 2010.2 in the coming weeks. The advanced XML syntax language implementation in the add-on allows you to specify XML schemas to use for validation and to drive automated IntelliPrompt for the end user. In the previous post on the subject we showed how to create an XHTML editor in a few lines of code with automated IntelliPrompt popups. One feature we just implemented was the ability to properly support xs:any nodes defined in the XML schemas. xs:any allows a schema to indicate that elements from any, other, or specific namespaces can be included as content within another element. Best of all, we ported this new functionality back to the WinForms Web Languages Add-on too! Let’s see an example…  Here is the WPF SyntaxEditor showing an XSLT document loaded. The XSLT is doing a transform to HTML. In the screenshot the mouse is over the xsl:value-of element, showing a quick info tip. Now let’s start typing a new start tag… More...
by Bill Henning (Actipro)
June 11, 2010 at 09:52
We wanted to squeeze one last feature into SyntaxEditor for Silverlight (our upcoming code editor control) before locking down the code for RTM. I’m pleased to announce that nearly all the IntelliPrompt completion list functionality found in the WPF version of SyntaxEditor will be available in the Silverlight version! Let’s see an example…  Here we are editing code in SyntaxEditor and press Ctrl+Space. This opens the completion list. The completion list is populated via a language service, meaning that each language implementation decides what to show and when, generally by examining AST data for the document. In this sample, we hard-coded some values. Once the completion list was opened, I typed an underscore character and the first item matched on that typed text so it became highlighted. Note that a description tip appeared next to the selected item, giving more detail about it. Description tips are fully customizable and can be built using our custom mini-HTML formatting language, or by inserting Silverlight controls directly. Note that there are a number of filter buttons and tabs in this completion list sample. You can click those buttons and tabs to filter out items that are presented in the list. I will uncheck the Method button and will select the Public members tab. This means that methods will no longer be shown and only public members will be displayed. Let’s see the result: That is really neat because it updates live. Note that use of the filter buttons and/or tabs is completely optional. Since we filtered out the item that was matched by our typed text, the top item is now partially selected. I hope this gives you a quick introduction to some of the upcoming SyntaxEditor for Silverlight’s completion list UI capabilities. Just imagine what you can do with these features in a Silverlight-based online IDE! This all will be available in the coming days when Silverlight Studio goes RTM! Continue watching our blog for details.
by Bill Henning (Actipro)
October 2, 2009 at 02:43
One feature that has been requested from several customers is the ability to show a completion list in response to starting to type a new word. This functionality can be seen in Visual Studio 2008. It can be thought of the same as typing in a letter that is a new word, and clicking on the VS 2008 “Display an object member list” button. Displaying a completion list in response to a language-specific character A previous build already added a property into the document text changed event arguments called e.TypedText that is filled in only if the text change was caused due to a single typing operation, in which case it contains the text that was typed by the end user. This allows you to handle that scenario (either via the SyntaxEditor.DocumentTextChanged event or via an IEditorDocumentTextChangeEventSink service implementation) and show a completion list when characters like “.” or “<” are typed. Of course the characters you respond to depend on the language in use. Here is a sample of how to display an JavaScript completion list in one of those handlers in response to a “.” character being typed: 1: switch (e.TypedText) {
2: case "<":
3: // Open completion list session here
4: break;
5: }
Note that the completion list code (defined elsewhere) is responsible for knowing what to show and when. These features are already available in the current build.
Displaying a completion list automatically when a new word is starting to be typed
We were thinking how could we make it easy so that customers can also optionally have their languages show a completion list when a new word is starting to be typed. The event args already give you all the information you need to determine if a new word is being typed, however it does involve a few lines of tedious text scanning. So we wrapped it all up into one handy property. Here is the code you’d add to your switch statement above if you wish to support automatic display of the completion list for word starts:
1: switch (e.TypedText) {
2: case "<":
3: // Open completion list session here
4: break;
5: default:
6: // If the text that was typed is a letter char that starts a word...
7: if (e.IsTypedWordStart) {
8: // If no completion session is currently open...
9: if (!editor.IntelliPrompt.Sessions.Contains(
10: IntelliPromptSessionTypes.Completion)) {
11: // Open the completion list session here
12: }
13: }
14: break;
15: }
The new e.IsTypedWordStart property is only true when a single letter character is typed and that letter is starting a new word. The word determination code uses the IWordBreakFinder service defined for your language too.
This new feature will be included in the next WPF Studio 2009.1 maintenance release.
by Bill Henning (Actipro)
September 10, 2009 at 02:43
One highly requested feature for SyntaxEditor for WPF is the ability to be notified when a mouse hover occurs so that IntelliPrompt quick info tips can be displayed in response. Since WPF doesn’t include a mouse hover event, we implemented one ourselves that fires for editor views. We didn’t stop there though. We wanted to make it simple for a language to provide quick info popups in response to mouse hover events. Thus we came up with the new IQuickInfoProvider service. This service can be registered with a language. It has three methods on it: 1: object GetContext(IHitTestResult hitTestResult);
2: object GetContext(IEditorView view, int offset);
3: void RequestSession(IEditorView view, object context, bool canTrackMouse);
We offer a QuickInfoProviderBase abstract class that should be used as a base class for any implementations of IQuickInfoProvider that you create. QuickInfoProviderBase fully implements mouse tracking such that when a mouse hover occurs over an editor view, it calls the GetContext overload that accepts an IHitTestResult. The IHitTestResult comes from our previously-discussed hit testing feature. The default implementation of this overload is to call the other GetContext overload if the hit is over a character in the text area.
The GetContext methods should return some object that gives detail about what is at the specified hit or offset, or a null reference if it is not important. This could be some object as simple as an IToken or some more complex context object. The important part is that it supports value equality (Equals method implementation) since as the mouse moves, the context returned by GetContext is compared against the context of any already-open quick info session to see if the existing session should be closed or kept open.
By using GetContext, the quick info provider knows when the mouse moves outside of the the region that is appropriate to an already-open quick info session, and when to open a new quick info session. Once a new quick info session is needed, the RequestSession method is called. It is passed the editor view instance, the context object returned by GetContext, and whether the mouse should be tracked (false when quick info is displayed in response to a toolbar button click for example).
Your RequestSession implementations are expected to create a new quick info session, store the passed context in the session, generate content for the quick info popup, and open the session (display the popup).
By using this new provider mechanism, it’s very easy for languages to automatically support quick info display with a minimal amount of work. All the mouse handling is done for you. This feature will be in the next build and we’ve updated our quick info sample to show how easy it is to use.
by Bill Henning (Actipro)
August 24, 2009 at 03:59
We’ve just released WPF Studio 2009.1 build 504. This is a huge update and includes some major new functionality that we’ll talk about in more detail over the coming days. In this post though, let’s do a brief overview of some of the larger updates. See our related forum announcement for exact details on what updates were made in each product. | DataGrid for WPF After a lot of user demand, we’ve added DataGrid functionality to WPF Studio. I’ve talked a lot about Actipro’s desire to embrace open source solutions as we move forward. Here is another instance. A lot of developers may not realize it but Microsoft has created an official WPF DataGrid that is open source and part of their CodePlex WPF Toolkit project. The DataGrid is slated to be part of .NET 4.0’s native controls as well. The DataGrid has many of the core features you’ll find in any grid offering. What we’ve done is made a number of extra enhancements and behaviors, and added them to an open source project of our own. This project also includes new Office themes that match the look of our other controls, along with updated system themes that look better than the default. Best of all, we’ve made the control take advantage of our ThemeManager so that you can switch themes on the fly. Our open source Contrib add-on is available on CodePlex at: We have taken things another step forward by offering an interop assembly that makes it simple to integrate our the masked and part-based editors in our Editors for WPF product with the DataGrid. Be sure to download the build 504 evaluation to see the new DataGrid functionality in action. | | SyntaxEditor for WPF MGrammar add-on gets asynchronous parsing, error reporting features The MGrammar add-on has been updated to use our parsing framework. Now when the Oslo Dataflow add-on is being used, as the end user types in the SyntaxEditor, a parse request is queued up and dispatched to a worker thread. The worker thread parses the entire document in the SyntaxEditor and builds an AST and list of syntax errors. These are returned back to the SyntaxEditor asynchronously, with no UI thread blocking. The MGrammar Integration sample has been updated to show an AST and error list that are built asynchronously as you type. Free ANTLR add-on added A popular request for years has been the ability to integrate the ANTLR parser with SyntaxEditor. With today’s release, this is now easy and can be done with very little code. The ANTLR add-on allows you to enable automated asynchronous parsing calls to the ANTLR parser, similar to the functionality described above for MGrammar. This previous blog post describes the functionality in detail. A new sample project has been added to demo this add-on. Completion list enhancements (auto-shrink, performance improvement) We’ve implemented another popular request item for completion lists: the ability to auto-shrink the visible list of completion items as the end user types. This functionality is found in Visual Studio when editing VB files. See this previous blog post for details and a series of screenshots showing the functionality. The performance of the completion list item matcher algorithms has been improved in a number of areas too. Hit testing This build adds the ability to perform detailed hit testing within SyntaxEditor. You simply pass it a Point and it returns an object that tells you everything you need to know about what is at that location. We’ve added a new QuickStart to show off the hit testing feature. |
by Bill Henning (Actipro)
August 13, 2009 at 04:24
We’re really excited to announce a new option coming in the next SyntaxEditor for WPF build that automatically filters out items in a completion list that don’t match the currently typed text. This feature can be seen in action when editing Visual Basic code in Visual Studio 2008. The completion list essentially hides items that can’t be matched with the text you’ve typed, allowing you to drill down and focus on the important items instead of keeping the entire list of items visible. The next build introduces a new ICompletionSession.CanFilterUnmatchedItems boolean property that when set to true enables this feature. We’ve also updated our completion list filtering QuickStart in the next build to show off the feature (see highlighted CheckBox): Unmatched item filtering in action Let’s walk through an example to show how it works. We press Ctrl+Space to show the completion list. No text is used to initialize the list so all items are visible. We now type an i character, which removes a number of items that don’t contain an i in them. Note that in this sample we have our acronym and shorthand item matchers active, not just the standard starts-with item matcher. Therefore if an i is found anywhere in an item’s text, it will be considered matchable. More...
by Bill Henning (Actipro)
June 15, 2009 at 10:06
The other day we posted about how syntax languages are changing to use the service locator design pattern. This design pattern allows us to generically make available new features for syntax languages, and for language designers to easily implement them. It’s a win-win for everyone. While we’ve been working on adding support for languages to respond to user input and show completion lists, etc., we changed the internal model we use for handling IntelliPrompt input to be based on the service locator design pattern as well. More...
by Bill Henning (Actipro)
February 19, 2009 at 20:38
Last week we discussed the concept of prioritized item matching algorithms and yesterday I talked about completion list matched text highlights.
We already have four matching algorithms in place for the default completion list implementation, two of which can be toggled on/off via options. All the matching algorithms simply implement an interface.
Now wouldn’t it be neat if you could write your own customized matching algorithm?
Well you can with SyntaxEditor, and it’s so easy too!
A SQL example
Let’s assume you are showing a list of SQL data objects and you want to implement a custom matcher that uses a regular expression to match any item that has the typed text appearing after a "." or "_" character. The default starts-with matcher should also be used to match text at the start of each item.
To start you’d make a custom class that inherits our RegexCompletionItemMatcherBase class.
1: public class CustomCompletionItemMatcher : RegexCompletionItemMatcherBase {
2: ...
Next you’d override a GetRegex method to return the Regex to use.
1: protected override Regex GetRegex(string text) {
2: // Make sure the text to highlight is surrounded with parenthesis
3: // so that SyntaxEditor can locate the captures
4: return new Regex(String.Format("[\\._]({0})", Regex.Escape(text)),
5: RegexOptions.IgnoreCase | RegexOptions.Singleline);
6: }
That’s it! The RegexCompletionItemMatcherBase base class has all the code in it to automatically match items and highlight matched text based on your Regex.
Here’s what the list looks like at run-time:
|

The custom item matcher in action, with results highlighted
|
Note that since we typed an L, the LOCATION.ID item was selected. However you can see that CUSTOMER.LAST_NAME and EMPLOYEE.LAST_NAME also had their L characters highlighted that occurred after a period. EMPLOYEE.CELL_NUMBER has L characters in it too but our algorithm didn’t match it because the L came after a letter and not a period or underscore.
More advanced implementations
While it is likely that the Regex-based item matcher will provide all the functionality you need for a custom item matcher implementation, sometimes you may require additional logic. No problem, there is a more low-level CompletionItemMatcherBase base class that lets you implement any sort of logic you desire to match items and return highlighted ranges over item text. All the base classes implement the ICompletionItemMatcher interface.
by Bill Henning (Actipro)
February 19, 2009 at 01:17
Continuing the series of posts regarding our advanced completion lists for the upcoming SyntaxEditor for WPF product, today I’d like to introduce another innovative new feature: matched text highlights.
Remember that matches are made using a series of prioritized item matching algorithms, as discussed in a previous post.
The completion list auto-selects the closest matched item in the list as you type. However another sort of useful visualization is to be able to see how typed text matches against other items as well.
|

SyntaxEditor showing a completion list with matched text on items highlighted
|
This is where matched text highlights come in. In the screenshot above, I typed as in the editor after displaying the completion list. By default, the completion list auto-selected AStringValue in the list however I moved the selection down with the arrow key so you could see the highlights.
The AStringValue item has the AS characters highlighted because the top priority starts-with algorithm matched my typed text there.
The Equals item has its a and s characters highlighted because the shorthand algorithm matched my typed text there. Shorthand also matched the as in GetHashCode.
Just like with normal auto-selection, SyntaxEditor cycles through the prioritized list of item matching algorithms and uses the first one that matches an item to show highlights indicating where matches were made.
We really think end users will love this feature!
|