Question

How can I know which keys triggered a RequestSession()?

Posted 7 years ago by Avatar Craig - Varigence, Inc.
Let's say I have a CompletionProvider class that implements ICompletionProvider. From within its RequestSession method, is there a way to determine which key-stroke (for instance, a period, Ctrl+Space, etc...) triggered the call to RequestSession?

Thanks,

-Craig

[Modified at 06/23/2011 01:23 AM]

[Modified at 06/23/2011 01:23 AM]

Comments (3)

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

Sorry but no. It shouldn't typically matter anyhow though because you want to show completion based on what has already been entered into the editor.

The best way to watch for keys is from an IEditorDocumentTextChangeEventSink.NotifyDocumentTextChanged handler since there you can check e.TypedText to see what was typed (it's only filled in for typed text) and it occurs after the text has already been inserted into the document. That's what we use in our add-ons.

Actipro Software Support
Posted 7 years ago by Craig - Varigence, Inc.
What would be the best way to detect when a user types Ctrl+Space? Use the syntax editor's KeyDown event? I tried using the DocumentTextChanged event but it didn't fire for Ctrl+Space.

Thanks again,

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

In the Silverlight SyntaxEditor, I'm not sure there's a good way to intercept Ctrl+Space since command handlers grab it (it's set up as an input binding). You could remove the input binding from SyntaxEditor and handle it yourself, to prevent that.

The command tied to Ctrl+Space just looks for a completion provider and if it finds one, calls RequestSession passing true to the second parameter. Maybe that's something you can look at since in other cases, false should generally be passed as the second parameter.

Actipro Software Support
Information The latest build of this product (2018.1 build 0230) was released 4 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.