Can I stop IntelliPrompt from overwriting text?

SyntaxEditor for WPF Forum

Posted 10 years ago by Craig - Varigence, Inc.
Version: 9.1.0500
Avatar
I have a scenario where I want to display IntelliPrompt after a particular keypress. For example, when the user enters the dot character.

I'm using a class that extends EditorViewInputProcessorBase to capture the text input by implementing OnTextInput and, when appropriate, displaying the intelliprompt list. My problem is that when I select an item in the list, its text replaces the editor's text instead of being inserted at the caret.

This seems like a bug since when I use Ctrl+Space to access IntelliPrompt, selecting an item inserts the text as expected.

Is there something special I need to do to ensure that non Ctrl+Space display of intelliprompt also performs text insertion?

Thanks,

-Craig

[Modified at 06/05/2009 06:58 PM]

Comments (6)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

Could you put together a simple sample project that shows this and email it over? This way we can determine if it is a bug and can fix it if it is. Please reference this post in your email. Thanks!


Actipro Software Support

Posted 10 years ago by Craig - Varigence, Inc.
Avatar
I've just sent a mail to your support alias with an attached sample project. Note that with the sample, I saw a different pattern than my original post. Specifically, if I typed a word and then used Ctrl+Space or the ‘.’ character to show IntelliPrompt, the selected word would replace the text. If I typed a couple spaces and then tried it, text insertion occurred. This still seems like a bug to me since I’d expect IntelliPrompt to never replace text already in the editor.

Thanks again,

-Craig
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Craig,

Thanks Craig, the problem here is that by using an input processor like you are, the text "." has not yet been inserted. So when you open the session, it's thinking that "." was typed AFTER the session started, and thus it replaces that text upon auto-complete.

So using an input processor is not a good way to look for ".", etc. As mentioned in this post, we are working on a better way to do this for the next maintenance release so please feel free to comment on those ideas.

We just added a new helper property for the next maintenance release that will be an ideal place to look for '.' characters. I'll post about it now in the other thread (line above).


Actipro Software Support

Posted 8 years ago by Matt Yaeger
Avatar
I've seen something similar in SE version 2010.2.0531 but I don't know if it's a bug or my misunderstanding. Here's the scenario:

1. Start with empty text
2. Press ctrl+space to get list that contains 2 items: 'foo', 'bar' (also have pre and post text to insert parens)
2. Select 'foo'. As expected 'foo()' is inserted.
3. Move caret back to beginning( just before the f).
4. Press ctrl+space to get the list. Select 'bar'


The result is: bar()(). The result I was looking for is: bar()foo(). I don't want the text to the right replaced but rather concatenated. I realize the it works now is the way it works in VS but I don't like it there either. Is there a way to get the effect I want? How can I make it work with the pre and post text not getting duplicated?

Thanks

Matt Yaeger
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

CompletionSession defines an Open method that just takes an IEditorView. If you call that method, it will initialize the text range to replace with characters around the caret. That method ends up calling the other Open method that also takes a TextRange, indicating the range to replace.

So it sounds like you'd want to always just call that other Open method overload that takes the TextRange. That way you can indicate using your own logic what should get replaced.


Actipro Software Support

Posted 8 years ago by Matt Yaeger
Avatar
Perfect. That was what I needed. Thanks
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.