Completion when cursor is before word

SyntaxEditor for WPF Forum

Posted 13 years ago by Rick Fleuren
Version: 11.1.0545
We are using the SyntaxEditor with auto completion for our very own language.

We see the following development: When we type an expression, everything is ok.

But when we try to outline the expression with spaces in the editor, the completion provider seems to look at the following character, founds the whole word in its list, and submits it, making the cursor jump after the word.

Is is possible, that when we only enter a space before a word that is already fully submitted, the completion provider can ignore it, and not submit the only entry it finds, because its already there?


TRUE OR FALSE is a valid expression in our language. When typing TRUE [space] the list comes back with several suggestions including OR, so we select OR, type [space] and enter FALSE into the syntaxeditor.

Now when we set our caret before OR, like so:


and type a [space], the completion box comes up with only OR, in stead of the complete suggestions list. A second [space] submits this OR and jumps the caret over it, placing the space after OR resulting in:


instead of the expected:


How can we resolve this problem?


Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Rick,

If I understand correctly, you are watching for [space] to be typed and when that occurs, you are programmatically showing the completion list, and are initializing the session via an Open method call where you pass a text range?

At least in the most recent build, if you call session.Open(view) instead of session.Open(view, textRange), our code for the former will try to find a word around the caret but will not do a full selection in the list if it's at the start of a word. Thus pressing space would insert a space and do no auto complete in your scenario. If you are passing us the text range via the other overload, you are telling us what to replace and our word start logic never kicks in.

Actipro Software Support

Posted 13 years ago by Rick Fleuren
Thanks!! Passing the text range fixed it
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.