% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/print.R
\name{format.ts_tree}
\alias{format.ts_tree}
\title{Format tree-sitter trees}
\usage{
\method{format}{ts_tree}(x, n = 10, ...)
}
\arguments{
\item{x}{\code{ts_tree} object.}

\item{n}{Number of lines, or number of selections to print.}

\item{...}{Currently ignored.}
}
\value{
Character vector of lines to print.
}
\description{
Format a \code{ts_tree} object for printing.
}
\details{
This is the engine of \code{\link[tsitter:print.ts_tree]{print.ts_tree()}},
possibly useful to obtain a printed representation without doing the
actual printing.\if{html}{\out{
</p><p><!-- ------------------------------------------------------>
}}


If there are selected nodes in the tree, those will be highlighted
in the output. See \code{\link[tsitter:ts_tree_select]{ts_tree_select()}} to
select nodes in a tree.\if{html}{\out{
</p><p><!-- ------------------------------------------------------>
}}
}
\examples{
\dontshow{if (requireNamespace("tsjsonc", quietly = TRUE)) withAutoprint(\{ # examplesIf}
# Create a parse tree with tsjsonc -------------------------------------
json <- tsjsonc::ts_parse_jsonc(
  '{ "a": 1, "b": [10, 20, 30], "c": { "c1": true, "c2": 100 } }'
)
format(json)
\dontshow{\}) # examplesIf}
}
\seealso{
Other ts_tree generics:
\code{\link[=[[.ts_tree]{[[.ts_tree()}},
\code{\link[=[[<-.ts_tree]{[[<-.ts_tree()}},
\code{\link[=print.ts_tree]{print.ts_tree()}},
\code{\link{select-set}},
\code{\link[=ts_tree_ast]{ts_tree_ast()}},
\code{\link[=ts_tree_delete]{ts_tree_delete()}},
\code{\link[=ts_tree_dom]{ts_tree_dom()}},
\code{\link[=ts_tree_format]{ts_tree_format()}},
\code{\link[=ts_tree_insert]{ts_tree_insert()}},
\code{\link[=ts_tree_new]{ts_tree_new()}},
\code{\link[=ts_tree_query]{ts_tree_query()}},
\code{\link[=ts_tree_select]{ts_tree_select()}},
\code{\link[=ts_tree_sexpr]{ts_tree_sexpr()}},
\code{\link[=ts_tree_unserialize]{ts_tree_unserialize()}},
\code{\link[=ts_tree_update]{ts_tree_update()}},
\code{\link[=ts_tree_write]{ts_tree_write()}}
}
\concept{ts_tree generics}
