/// <summary> /// Set all #region collapsibles in a document /// </summary> /// <param name="document">document that holds the regions</param> /// <param name="isExpanded">should region be expanded</param> public static void SetAllRegions(IEnumerable <CodeItem> document, bool isExpanded) { var regions = new List <CodeItem>(); FindHelper.Find(regions, document, CodeItemKindEnum.Region); foreach (var region in regions.Distinct()) { var collapsible = FindCollapsibleFromCodeItem(region, _manager, _textView); SetRegionIsExpanded(document, collapsible, isExpanded); } }
private static void SetRegionIsExpanded(IEnumerable <CodeItem> document, ICollapsible region, bool isExpanded) { var startLine = GetStartLineForCollapsible(region); var found = new List <CodeItem>(); FindHelper.Find(found, document, startLine); if (!found.Any()) { return; } var item = found.Last(); if (!(item is IMembers)) { return; } (item as IMembers).IsExpanded = isExpanded; }