DelimiterAutoCompleter working inconsistently with SyntaxEditor in DataGridView

SyntaxEditor for WPF Forum

Posted 5 years ago by Matt Gerrans
Version: 14.2.0610
Avatar

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?

Comments (3)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Matt,

It's better design to just register a new instance of your DelimiterAutoCompleter in the constructor of your custom language class.  Then all the language initialization code is together.

I would suggest that for the issue itself, you first isolate the scenarios it works and doesn't work in.  I would expect those cases to be able to repro consistently.  It shouldn't matter if a SyntaxEditor is located in one data grid cell or another.

It would help us if you can repro them in one of our add-on language implementations so that we can see the scenario in which its not working properly.  Or if you can't do that, make a new simple sample project of your own with your language and have that sample repro the issue.  Then email our support address with that sample in a renamed .zip file so it doesn't get spam blocked, and be sure to reference this thread.


Actipro Software Support

Posted 5 years ago by Matt Gerrans
Avatar

Since my language class is in one of auto-generated files of the language designer tool, I was reticent to modify it, since it'll be regenerated every time we have language syntax updates.   I guess the way to do that would be make a derived class from the auto-generated one and make the modifications there, right?

I already have a separate sample app that is not as complex as our real app; I'll see if I can repro/isolate there...

Thanks,

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes that is one way to do it (with a derived class).


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.