Showing a Completion List Automatically When a New Word Is Started

SyntaxEditor for WPF Forum

Posted 12 years ago by Matt Yaeger
Version: 11.2.0554
Avatar

In your docs you give brief instructions on how to automatically show a completion session on the start of a new word.  One question I have is the TypedText property always one character?  I haven't seen it be more than one.  The second question is how do I make it behave just like it would if I launched the completion session with ctrl+space?  For instance, say I have a completion session with 'foo', 'bar', and 'baz' as CompletionItems.  If I use ctrl+space bring up the  session and then type 'f' it will filter down to just 'foo'.  In another scenario say I first type 'f' which will automatically launch the completion session and then type 'o' it will show now results b/c there are no ComplettionItems that start with 'o'.  So how do I get the TypedText to be included in the filtering (if that makes sense) of the CompletionSession?  

Thanks

 

Matt Yaeger

Comments (3)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Matt,

We've never seen it be more than one character, but it's based on the normal WPF TextInput event and I suppose that in certain foreign languages, there is a chance that multiple characters could be composed via IME.

Completion sessions base their matching on the TextRange that is passed to the session's Open method.  There are two overloads, one that takes an IEditorView and TextRange where you can indicate the range to use for initialization, and the other that only takes an IEditorView.  For the latter, our code does its best to try and determine the TextRange to pass to the former overload, based on if there are word characters right before the caret.

Then of course the filtering feature you describe is the completion session's CanFilterUnmatchedItems option, which is false by default.


Actipro Software Support

Posted 12 years ago by Matt Yaeger
Avatar

Ohhhh, that's what the text range is for. Thanks.  So in my case I would want to pass in a text range that encompasses the TypedText?

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Bingo!


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.