I have the Syntax Editor in a DataGridView, so on instance is created then activated for whatever row in the DGV is selected. I'm observing that the delimiter auto completion is working fine sometimes, but not others, as I select different cells that have the editor. The construction of the editor occurs only once and that is where I set up the DelimiterAutoCompleter, so it seems like it should continue to work the regardless of what row I select. Here is what my code looks like:
internal class SyntaxEditorInternal : ElementHost
{
private static DelimiterAutoCompleter _delimiterAutoCompleter = new DelimiterAutoCompleter
{
CanCompleteAngleBraces = true,
CanCompleteCurlyBraces = true,
CanCompleteDoubleQuotes = true,
CanCompleteParentheses = true,
CanCompleteSingleQuotes = false,
CanCompleteSquareBraces = true
};
// ...
public SyntaxEditorInternal()
{
var syntaxEditor = new SyntaxEditor();
Child = syntaxEditorWrapper;
syntaxEditor .Document.Language = new CmdVarSyntaxLanguage();
syntaxEditor.IsDelimiterAutoCompleteEnabled = true;
syntaxEditor .Document.Language.RegisterDelimiterAutoCompleter(_delimiterAutoCompleter);
// ...
}
// ...
}
So, whenever the editor is created, the DelimiterAutoCompleter is registered and it is never unregistered.
What's a good way for me to investigate why the auto completion works in some cases and not in others? It seems like it should just be a matter of whether the service is registered and IsDelimiterAutoCompleteEnabled being true. Are there any other things that can affect it?