private void CreateHiddenRegions(AuthoringSink sink, ParseTree parseTree, Source source) { var regionCreator = new RegionCreator { Root = parseTree.Root, Source = source }; regionCreator.CreateRegionsFor(GherkinGrammar.Description, GherkinGrammar.GivenWhenThenClause); sink.ProcessHiddenRegions = true; foreach (var textSpan in regionCreator.Result) sink.AddHiddenRegion(textSpan); }
private static void AddHiddenRegions(AuthoringSink sink, IEnumerable<AstNode> content) { foreach (AstNode astNode in content) { if ((astNode is XmlElement || astNode is NVForeachDirective) && (astNode.Position.StartLine < astNode.Position.EndLine)) { // NewHiddenRegion region = new NewHiddenRegion(); // region.dwBehavior = (uint)HIDDEN_REGION_BEHAVIOR.hrbEditorControlled; // region.dwState = (uint)HIDDEN_REGION_STATE.hrsExpanded; // region.iType = (int)HIDDEN_REGION_TYPE.hrtCollapsible; // region.pszBanner = "..." + xmlElement.Name + "..."; TextSpan hiddenTextSpan = new TextSpan(); hiddenTextSpan.iStartLine = astNode.Position.StartLine - 1; hiddenTextSpan.iStartIndex = astNode.Position.StartPos - 1; hiddenTextSpan.iEndLine = astNode.Position.EndLine - 1; hiddenTextSpan.iEndIndex = astNode.Position.EndPos - 1; // region.tsHiddenText = hiddenTextSpan; sink.AddHiddenRegion(hiddenTextSpan); // Add child regions if (astNode is XmlElement) AddHiddenRegions(sink, ((XmlElement)astNode).Content); else if (astNode is NVForeachDirective) AddHiddenRegions(sink, ((NVForeachDirective)astNode).Content); } } }