Completion Provider - Get which key was used to commit

SyntaxEditor for WPF Forum

Posted 2 years 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 2 years 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 2 years 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 (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.