/// <inheritdoc /> public Task Analyze(SyntaxNode node, CancellationToken token) { if (node is null) { return(Task.CompletedTask); } var root = new SortedTree <CodeStructureItem>(new CodeStructureItem() { Name = "File" }); var memberDeclarations = node .DescendantNodes(_ => true) .OfType <T>() .Where(x => KnownNodeTypes.Contains(x.GetType())); foreach (var declaration in memberDeclarations) { foreach (var mappedItem in NodeMapper.MapItem(declaration)) { var element = new SortedTree <CodeStructureItem>(mappedItem, declaration); var parent = root.FirstOrDefault(x => x.Meta == declaration.Parent) ?? root; if (NeedsMetaNode(declaration)) { var realParent = parent.Children.FirstOrDefault(x => x.Data.GetType() == element.Data.GetType() && x.Data.IsMeta); if (realParent is null) { var metaData = RoslynMetaNodeCreator.Create(element.Data); var metaNode = new SortedTree <CodeStructureItem>(metaData); parent.Add(metaNode); parent = metaNode; } else { parent = realParent; } } parent.Add(element); } } NodeList = root.Skip(1).ToList(); return(Task.CompletedTask); }