Esempio n. 1
0
        private void WriteTriviaNode(TreeViewItem treeNodeItem, SyntaxTrivia syntaxTrivia, string message = "")
        {
            var lastNode = treeNodeItem.Items[treeNodeItem.Items.Count - 1] as TreeViewItem;

            lastNode?.Items.Add(new TreeViewItem
            {
                Header     = $"{message} { syntaxTrivia.Kind() } - {syntaxTrivia.FullSpan}",
                Foreground = TreeNodeColor.ColorNode(null)
            });
        }
Esempio n. 2
0
        private void TraverseCodeDom(SyntaxNode currentRoot, TreeViewItem node)
        {
            var decendents = currentRoot.ChildNodesAndTokens();

            foreach (var syntaxNode in decendents)
            {
                var headerNode = new TreeViewItem
                {
                    Header     = $"{syntaxNode.Kind()}",
                    Foreground = TreeNodeColor.ColorNode(syntaxNode)
                };

                node.Items.Add(headerNode);
                AddTriviaIfAvailable(syntaxNode, node);

                if (syntaxNode.IsNode)
                {
                    TraverseCodeDom((SyntaxNode)syntaxNode, node.Items[node.Items.Count - 1] as TreeViewItem);
                }
            }
        }