ICompilationUnit.SyntaxError changes not visible in editor

SyntaxEditor for Windows Forms Forum

Posted 9 years ago by Brad S. - MedAssets, Inc.
Version: 4.0.0282
Avatar
I'm working on a custom grammar for a Pascal-like language. It's been working for months now but I just got around to checking variable and function references. So, after all of the parsing is complete, I use a custom AstVisitor to comb through the editor's AstNodes and add SyntaxErrors with TextRanges to the ICompilationUnit for undefined variables and function calls.

Unfortunately, these late syntax errors do not show in the editor (with red squigglies underneath). I tried calling Editor.RefreshOutlining() and Editor.Refresh() but no go. The syntax errors are there in the IList. Why don't they show in the editor? How can I get the syntax editor to repaint all the syntax errors again?

Thanks,
Brad

Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Brad,

I believe one way to retrigger it would be to do this:
var data = document.SemanticParseData;
document.SemanticParseData = null;
document.SemanticParseData = data;
That would simulate an update from the semantic parser and would trigger error display again.


Actipro Software Support

Posted 9 years ago by Brad S. - MedAssets, Inc.
Avatar
Are you sure? I tried that and it didn't work.

    MyCompilationUnit compilationUnit = (MyCompilationUnit)codeEditor.Document.SemanticParseData;
    MyAstRefChecker checker = new MyAstRefChecker( compilationUnit );
    compilationUnit.Accept( checker );
    Debug.Assert( compilationUnit.SyntaxErrors.Count > 0 );

    this.Invoke( (MethodInvoker)delegate() {
        var data = codeEditor.Document.SemanticParseData;
        codeEditor.Document.SemanticParseData = null;
        codeEditor.Document.SemanticParseData = data;
    } );
I had to invoke it in order to prevent a nasty hang (this is in an event handler). Any other ideas or are you sure that should work (and I just didn't try hard enough)?

Thanks,
Brad
Posted 9 years ago by Brad S. - MedAssets, Inc.
Avatar
Actually, it's not working in my test application but it's working great in the real application. I'm not even mucking around by null SemanticParseData, it's just working. So, consider this resolved. If that turns out not to be true, I'll get back to you with more details.

My test app was loading a monstrously huge file so perhaps there's more involved there.

Thanks again,
Brad
The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.