Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/21/16 01:53:02 (8 years ago)
Author:
jkarder
Message:

#2563: merged r13549 into stable

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeFolding/CSharp/CSharpCodeFoldingStrategy.cs

    r12009 r14134  
    3131      var result = new CodeFoldingResult();
    3232
    33       var foldingContext = new CSharpCodeFoldingContext(document);
    34       var v = new FoldingVisitor();
    35       v.document = foldingContext.Document;
    36       foldingContext.SyntaxTree.AcceptVisitor(v);
    37       result.FoldingData = v.foldings.OrderBy(x => x.StartOffset).ToList();
     33      try {
     34        var foldingContext = new CSharpCodeFoldingContext(document);
     35        var v = new FoldingVisitor();
     36        v.document = foldingContext.Document;
     37        foldingContext.SyntaxTree.AcceptVisitor(v);
     38        result.FoldingData = v.foldings.OrderBy(x => x.StartOffset).ToList();
    3839
    39       var firstError = foldingContext.SyntaxTree.Errors.FirstOrDefault();
    40       firstErrorOffset = firstError != null
    41         ? foldingContext.Document.GetOffset(firstError.Region.Begin)
    42         : int.MaxValue;
     40        var firstError = foldingContext.SyntaxTree.Errors.FirstOrDefault();
     41        firstErrorOffset = firstError != null
     42          ? foldingContext.Document.GetOffset(firstError.Region.Begin)
     43          : int.MaxValue;
     44      } catch {
     45        // ignore exceptions thrown during code folding
     46        firstErrorOffset = int.MaxValue;
     47      }
    4348
    4449      return result;
Note: See TracChangeset for help on using the changeset viewer.