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

SyntaxEditor Web Languages Add-on for Silverlight Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0111
Avatar
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 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 13 years ago by Craig - Varigence, Inc.
Avatar
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 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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

The latest build of this product (v18.1 build 0233) was released 4 years ago, which was after the last post in this thread.