I'm trying to implement a Completion Custom Action as shown in the IntelliPrompt QuickStarts. I can successfully display a dialog, but the example doesn't show how to then insert text based on the dialog selection into the document.
I have tried
IEditorDocument document = session.View.SyntaxEditor.Document; TextRange range = session.SnapshotRange.TextRange; // Display dialog here with Window.ShowDialog document.ReplaceText(TextChangeTypes.AutoComplete, range, myNewText);
I had to save the document & range before displaying the dialog, as otherwise session.View was null after ShowDialog returned, and session.SnapshotRange.IsDeleted was true.
This inserts the new text, but if the user typed a few characters to get to the completion item, they are not replaced as they would be if a normal completion item was selected.
What is the recommended way of doing this?