Syntax editor: quick info prompt dose not show on hover of squiggle tag

SyntaxEditor for WPF Forum

The latest build of this product (v24.1.5) was released 2 months ago, which was before this thread was created.
Posted 4 days ago by Mattias Ström
Version: 24.1.5
Avatar

The tag squiggle line is present and the parser tags has quick info but my custome tagger shows the squiggle lines but without quick info prompt, how to fix this?

    public ExpressionsSyntaxLanguage() : 
            base("Expressions") {

        // Create a classification type provider and register its classification types
        ExpressionsClassificationTypeProvider classificationTypeProvider = new ExpressionsClassificationTypeProvider();
        classificationTypeProvider.RegisterAll();
      
        // Register an ILexer service that can tokenize text
        this.RegisterService<ILexer>(new ExpressionsLexer(classificationTypeProvider));                        
        
        // Register an ICodeDocumentTaggerProvider service that creates a token tagger for
        //   each document using the language
        this.RegisterService(new ExpressionsTokenTaggerProvider(classificationTypeProvider));

        // Register a squiggle tag quick info provider
        this.RegisterService(new SquiggleTagQuickInfoProvider());

        // Register a parser
        this.RegisterParser(new ExpressionsParser());

        // Register a tagger provider for showing parse errors
        this.RegisterService(new CodeDocumentTaggerProvider<ParseErrorTagger>(typeof(ParseErrorTagger)));            

        this.RegisterService<ICompletionProvider>(new ExpressionsCompletionProvider());

        this.RegisterService(new TextViewTaggerProvider<ViewModelAwareTagger>(typeof(ViewModelAwareTagger)));            
    }
}
public class ViewModelAwareTagger : TaggerBase<ISquiggleTag>
{
    private readonly IEditorView _view;

    public ViewModelAwareTagger(IEditorView view) : base("Custom",
        null, view.SyntaxEditor.Document, true)
    {
        _view = view;
    }

    public override IEnumerable<TagSnapshotRange<ISquiggleTag>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object parameter)
    {
        if (snapshotRanges != null)
        {

            foreach (var snapshotRange in snapshotRanges)
            {
                var text = snapshotRange.Text;
                if (_view.SyntaxEditor.Tag is PropertyDescriptorPropertyModel descriptorPropertyModel && descriptorPropertyModel.Target is BaseFirmwareViewModel vm)
                {
                    foreach (var error in LogicalExpressionValidationHelper.Validate(text, vm))
                    {
                        var tag = new SquiggleTag(ClassificationTypes.SyntaxError, new PlainTextContentProvider(error.Message));

                        var targetSnapshotRange = snapshotRange;
                        if (targetSnapshotRange.IsZeroLength)
                        {
                            targetSnapshotRange = new TextSnapshotRange(targetSnapshotRange.Snapshot, targetSnapshotRange.StartOffset, targetSnapshotRange.StartOffset + 1);
                        }

                        yield return new TagSnapshotRange<ISquiggleTag>(TextSnapshotRange.FromSpan(targetSnapshotRange.Snapshot,
                                targetSnapshotRange.StartOffset + error.MatchIndex, error.MatchLength), tag);
                    }
                }
            }
        }
    }
}

[Modified 4 days ago]

Comments (3)

Posted 3 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Nothing stands out as incorrect there since it appears you are creating the SquiggleTag with a quick info content provider, you said squiggles are appearing, and you've registered the SquiggleTagQuickInfoProvider language service. 

We can take a look at it if you make a new simple sample project that shows it happening and send that to our support address.  Reference this thread in your email and exclude the bin/obj folders from the .zip you send.  Then we can debug with that and see where things are going wrong.


Actipro Software Support

Posted 3 days ago by Mattias Ström
Avatar

The sample is sent

Posted 2 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thank you for sending the sample.  I've run the sample locally and the QuickInfo is appearing as expected.  All I do is run the sample, type any text in the editor, and then hover over the text with the squiggle.  When I do, I see the QuickInfo message "Parsing completed before reaching document end."

I even tried installing a new instance of Visual Studio in Windows 11 Sandbox (which is a clean environment) and running your sample there.  I had the same result.

Are you able to reproduce the issue on more than one machine?

I do wonder if perhaps there's a z-order problem and the QuickInfo is appearing behind the window.  If you run using Visual Studio and have the Live Visual Tree tool window open when running, you should, by default, see an entry for "[MainWindow]" when the application launches.  When I hover over the squiggle tag, I see "[PopupRoot]" appear as well.  If you see "[PopupRoot]" but don't see the actual popup, it could be behind the window.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.