Represents either a syntax node or syntax token from TypeScript. NOTE: If you change the properties here, you must change the corresponding properties in the TypeScript tree builder or it won't deserialize correctly.
        internal void UpdateWithSyntaxRoot(SyntaxNodeOrToken root, int position)
        {
            clear();
            TreeViewItem rootItem = null;
            rootItem = new TreeViewItem();
            TreeContainer.Items.Add(rootItem);

            rootItem.DataContext = root;
            generateSyntaxTreeView(root, rootItem);
            selectCorrespondingTreeViewItem(position);
        }
        private void generateSyntaxTreeView(SyntaxNodeOrToken node, TreeViewItem item)
        {
            item.Header = node.Kind + " [" + node.StartPosition + ".." + node.End + ")";

            if (node.IsToken)
            {
                item.Foreground = Brushes.Green;
            }
            else
            {
                item.Foreground = Brushes.Blue;
            }

            foreach (var child in node.Children)
            {
                var childItem = new TreeViewItem();
                childItem.DataContext = child;
                item.Items.Add(childItem);
                generateSyntaxTreeView(child, childItem);
            }
        }