Completion Provider - Get which key was used to commit

SyntaxEditor for WPF Forum

Posted 11 months ago by Josh
Version: 17.2.0
Avatar

Hello,

How can I get which key was used to commit the completion provider?

Thanks!

Comments (2)

Posted 11 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Josh,

There's not anything that tracks that right now, as there are a number of things that could trigger a commit (key, mouse, programmatic, etc.).  But as mentioned in this related thread, you could possibly override the CompletionSession.OnViewTextInput method to track the last text input.


Actipro Software Support

Posted 11 months ago by Josh
Avatar

yeah, this is what I ended up with so far:

private class CustomCompletionSession : CompletionSession
{
	public KeyEventArgs LastKeyEvent { get; protected set; }

	protected override void OnViewKeyDown(IEditorView view, KeyEventArgs e)
	{
		LastKeyEvent = e;
		base.OnViewKeyDown(view, e);
	}
}
The latest build of this product (v22.1.4) 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.