PreText & PostText don't work as expected in CompletionItems

SyntaxEditor for WPF Forum

Posted 11 years ago by Craig - Varigence, Inc.
Version: 10.2.0531
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
I have an application where I'm using the WPF SyntaxEditor and am displaying completion lists. It's working well except for two problems that I believe are bugs:

1. When I create a new CompletionItem (to add to the session's Items list), I give it a Text value in its constructor, but may also give it an autoCompletePreText and autoCompletePostText. My expectation from the documentation is that if I provide both, (as in new CompletionItem("Bob", new CommonImageSourceProvider(CommonImage.PropertyPublic, null, "(", ")"); ), and the user selects that intelliprompt item, they'll see (Bob) inserted into the editor. Instead, all I'm seeing is () - so the preText and the postText, with no regular Text in between. If this is the intended behavior, how can I get preText and postText to work with text inserted in between?

2. In the sample app I've sent off that repros this, I'm also seeing that after I double click on a completion item, the syntax editor throws a NullReferenceException and the application crashes.

Please let me know if you need more information. I am sending over a sample application that reproduces the issue.



Comments (2)

Posted 11 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Hi Craig,

I can comment on item #1. This looks like the intended behavior as I understand. When you only provide 'Text' (no pre- or post-text), it will use the provided text as the pre-text for completion and leave post-text blank. If you manually populate the pre- and post-text values, the 'Text' is used for displays purposes in the list only, and the inserted text will be what you entered.

I assume you want to insert "Bob()" instead of "()" with the caret between parenthesis, so you would need to set...
Text = "Bob" (for display without the parenthesis)
PreText = "Bob("
PostText = ")"
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Craig,

Boyd is right on #1, when you specify pre- and post-text, those will be what is inserted and the normal "text" is only for display purposes.

For #2, it appears there were issues if you tried opening a second session in the DocumentTextChanged event fired by the first session's commit. We've updated code for the next maintenance release that allows this and I successfully tested it with your sample.

Actipro Software Support

The latest build of this product (v21.1.2) was released 20 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.