Posted 14 years ago by tobias weltner
Avatar
Let's say I have two constructs that support code folding:
{ } and <% %>
When I write this:
{
<%


}

and then examine "<%", its node property "isOpen" returns false although this node really is open, isn't it?
Also, how would I find the first child node (in this case "<%") given the parent node (in this case "{")?

Background of this question is that I'd like to support autocomplete for code blocks. To do that, I first need to examine whether the block is incomplete. For this, I'd like to use "isOpen", but if it returns false for all child nodes, this wouldn't work.

Comments (7)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hmmm... that should return that the &lt;% is open. Can you email us your language definition and parser for this?

To find the first child, just use the indexer of the current OutliningNode and pass in a zero index. Alternatively if you are looking for a child node that contains a specific offset, you can use FindNode or FindNodeRecursive depending on what you need.


Actipro Software Support

Posted 14 years ago by tobias weltner
Avatar
I'll prepare a sample for you. Funny enough, sometimes the nodes are open, sometimes not, depending on how I nest them.
isOpen does correspond with the graphical line marks. So if it reports isOpen=true, there indeed is an open line end.
Problem is that for some reason and in some situations, open nodes get closed by child nodes.
Posted 14 years ago by tobias weltner
Avatar
Take your editor sample and vb.net language definition and enter this:

#region

{

#endregion

"{" should be an open node but it isn't.
Why?
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It looks like you're using C# syntax in a VB.NET language. So { isn't recognized in VB.NET.

When I pasted the above code in C#, it worked fine and { was marked open.


Actipro Software Support

Posted 14 years ago by tobias weltner
Avatar
My fault, I meant c#.

When I paste this code in:
#region
{
}
#endregion

I get a plus sign in front of #region and {
I get two short horizontal lines in front of } and #endregion
All is fine.

When I delete "}", there is just ONE short horizontal line left. From my understanding, there should still be two, one of which is open-ended since the end of the "{"-outlining node is missing.

So "{" starts an outlining node that is ended with #endregion, and when I collapse "{", it also collapses #endregion.

How can it be that one outlining node without an end uses the surrounding outlinenode's end as its own missing end?
Also, isOpen is false and suggests the outlining node was complete when in reality it is incomplete.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If a node is open, it will use the end offset of the parent node as its end offset. So it is behaving as designed.

I see that IsOpen is true for the brace when I debug it. I think you're looking at the wrong node for that. Remember that there is a root outlining node so there's really three nodes in this situation.


Actipro Software Support

Posted 14 years ago by tobias weltner
Avatar
OK, I'll try and re-check the isOpen property.
Thanks!
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.