Delimiter auto-completion problem

SyntaxEditor for WPF Forum

Posted 5 months ago by Sunshine - Appeon
Version: 20.1.1
Platform: .NET 5.0
Environment: Windows 10 (64-bit)
Avatar

I developed an HTML editor and provided Delimiter auto-completion function.

In this case, only a quote will appear.

<div class="

Then enter the double quotes again.

<div class="""

After debugging "DelimiterAutoCompleter", I found that the parsed token was wrong, and it resolved =" into StartTagAttributeStringValueStartDelimiter

Cause the first automatic symbol to not complete.

Where is the definition of "LineTerminatorWhitespace" in html.langdef? I can’t find its definition, so I don’t know if it causes a matching error

Comments (3)

Posted 5 months ago by Sunshine - Appeon
Avatar

I found the problem, the matching formula of "StartTagAttributeStringValueStartDelimiter" is Pattern="= {LineTerminatorWhitespace}* \&quot;"

When HTML uses "DelimiterAutoCompleter", this causes the above error.

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

Hello,

Can you tell us the code you used to register the DelimiterAutoCompleter on the syntax language so that we can try the same thing here?


Actipro Software Support

Posted 5 months ago by Sunshine - Appeon
Avatar

Rewriting the method in DelimiterAutoCompleter can solve the problem.

protected override bool IsValidStartDelimiter(ITextSnapshotReader reader, char startDelimiter)
        {
            if (reader != null && reader.IsAtTokenStart)
            {
                var token = reader.PeekTokenReverse();

                if (token != null) //This condition in the base class contains token.length==1
                {
                    return this.IsValidStartDelimiter(token, startDelimiter);
                }
            }

            return false;
        }
The latest build of this product (v21.1.2) was released 18 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.