Exemplo n.º 1
0
                private static TagSpan GetTagSpan(ITextSnapshot snapshot, int start, int end, int headerIndex)
                {
                    TagSpan tagSpan = null;

                    try {
                        int testLen = headerIndex - start + 1;
                        if (start != -1 && end != -1)
                        {
                            int length = end - start - testLen;
                            if (length > 0)
                            {
                                var span = new Span(start + testLen, length);

                                tagSpan = new TagSpan(
                                    new SnapshotSpan(snapshot, span),
                                    new OutliningTag(snapshot, span, true)
                                    );
                            }
                        }
                    }
                    catch (ArgumentException) {
                        // sometimes the parser gives us bad spans, ignore those and fix the parser
                        Debug.Assert(false, "bad argument when making span/tag");
                    }

                    return(tagSpan);
                }
 public override bool Walk(FunctionObject node) {
     // FunctionExpressions contain FunctionObjects.
     // Therefore we only need to handle FunctionObjects to handle both.
     if (node.Body.Braces != BraceState.StartAndEnd) {
         return false;
     }
     TagSpan span = GetFunctionSpan(_ast, _snapshot, node);
     OutliningTagSpans.Add(span);
     return base.Walk(node);
 }