4.0: Can't get collapsing C# regions to work.

SyntaxEditor for Windows Forms Forum

Posted 13 years ago by Dierk Droth
Avatar
Hi,

I'm loading C# code to editor and try to collapse all regions as by tutorial:

protected override void OnDocumentTextChanged(Document document, DocumentModificationEventArgs e) {
    // If programmatically setting the text of a document...
    if (e.Modification.HasFlag(DocumentModificationFlags.ProgrammaticTextParse)) {
        // Collapse all outlining region nodes
        document.Outlining.RootNode.CollapseDescendants();
    }
}
Unfortunately it does not work: all regions are still expanded.

After loading I can collapse manually though.

Please advice, thanks

Dierk

Comments (4)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Dierk,

Thanks, we'll have to find another way to do it for the .NET Languages Add-on. The tutorial way works fine for dynamic languages (like the C# there). The problem with the add-on version of C# is that the semantic parsing and outlining are done via the semantic parser service, so they happen after DocumentTextChanged fires at some arbitrary time. Maybe we need to add some sort of new method that could fire appropriately for both cases (language that uses the semantic parser service vs. one that doesn't) and you could put the code there.


Actipro Software Support

Posted 13 years ago by Dierk Droth
Avatar
Thanks for looking into that.

This feature - which worked well in V3 - is mandatory for our product.

Any idea on when it will be available again?

Thanks

Dierk
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hopefully we'll have a build with a way to do it in the next couple weeks.


Actipro Software Support

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This is resolved for the next beta release. An OnDocumentAutomaticOutliningCompleted method has been added that occurs after outlining finishes, regardless of whether it is done in the worker thread.

The C# language in the .NET Languages Add-on uses this now to collapse regions.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.