Posted 8 years ago by NorthGates - NorthGates Systems
Version: 4.0.0287
Avatar
If on one line I have an error, the parser stops looking further down the document. Is there a way to display span indicator error for all errors in a document. I remove some error span indicators (kind of overriding xsd validation) but the document will not show any errors pass this point.

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We'd probably need a new simple sample project from you that shows what you mean. The add-on shows multiple errors for us when we test it. If you want to make a sample for us to view, please rename the .zip file extension so it doesn't get spam blocked and email it to our support address.


Actipro Software Support

Posted 8 years ago by NorthGates - NorthGates Systems
Avatar
Well it would take too long. I managed to have all the error indicator to show but as soon as I remove an error indicator from the code below, the error above the line will show but not the ones after.
void editor_DocumentIndicatorAdded(object sender, IndicatorEventArgs e)
{
    // Remove any syntax errors that has this tag prefix ie: <aa:myTagName> ... "'aa' is an undeclared prefix. Line 5, position 3." 
    if (e.Indicator is SyntaxErrorSpanIndicator)
    {
        SyntaxErrorSpanIndicator si = (SyntaxErrorSpanIndicator)e.Indicator;
        if (((SyntaxError)si.Tag).Message.Contains("'aa'"))
        {
            Console.WriteLine(((SyntaxError)si.Tag).Message);
            editor.Document.SpanIndicatorLayers[SyntaxErrorSpanIndicator.DefaultName].Remove(si);
        }
    }
}
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
NorthGates,

I wouldn't recommend changing indicators there. Instead, handle the DocumentSemanticParseDataChanged event (perhaps even on an OnDocumentSemanticParseDataChangedoverride of your language), and look at the CompilationUnit that was returned. It has a SyntaxErrors collection on it that you can modify, I believe before the UI gets updated.


Actipro Software Support

Posted 8 years ago by NorthGates - NorthGates Systems
Avatar
Thanks Admin for pointing to the right location, it works but what I did is in the prefilter memberlist I removed the aa: then in the event below I catch the namespace endswith.
Here is the code:

protected override void OnDocumentSemanticParseDataChanged(Document document, EventArgs e)
        {
            base.OnDocumentSemanticParseDataChanged(document, e);
            if (document.SemanticParseData == null) return;
            IList syntaxErrors = ((ICompilationUnit)document.SemanticParseData).SyntaxErrors;

            Console.WriteLine("Errors Before: {0}", syntaxErrors.Count);
            for (int index = 0; index < syntaxErrors.Count; index++)
            {
                SyntaxError error = (SyntaxError)syntaxErrors[index];
                if (error.Message.Contains("/aa"))
                    ((ICompilationUnit)document.SemanticParseData).SyntaxErrors.RemoveAt(index);
            }
            Console.WriteLine("Errors After: {0}", syntaxErrors.Count);
        }
The latest build of this product (v2018.1 build 0341) was released 10 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.