Outlining with JSON

Hi there - I was just looking at your latest version. (It’s sounding great by the way). I was hoping to use this tool to show JSON data to my users. I see there is a JSON parser now but I was hoping that there would be the ability to expand/collapse sections. I can’t seem to get anything to work - am I missing something? thx!

Hi,

You can subclass your own parser from JSONParser and override the following method:

   public class MyJSONParser : JSONParser
        {
            protected override bool ParseTypeExpression(ref ISyntaxNode node)
            {
                bool result = base.ParseTypeExpression(ref node);
                if (node != null)
                    node.Options |= SyntaxNodeOptions.Outlining;
                return result;
            }
        }

Then outlining section will be created for { } expressions.

Let me know if it helps and we will push this change to the JSONParser itself.

Regards,
Dmitry

Perfect - that works great thx!