% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ts-tree-select.R
\name{ts_tree_selection}
\alias{ts_tree_selection}
\alias{ts_tree_selected_nodes}
\title{Helper functions for tree-sitter tree selections (internal)}
\usage{
ts_tree_selection(tree, default = TRUE)

ts_tree_selected_nodes(tree, default = TRUE)
}
\arguments{
\item{tree}{A \code{ts_tree} object as returned by \code{\link[=ts_tree_new]{ts_tree_new()}}.}

\item{default}{Logical, whether to return the default selection if there
is no explicit selection, or \code{NULL}.}
}
\value{
\code{ts_tree_selection()} returns a list of selection records.

\code{ts_tree_selected_nodes()} returns the ids of the currently
selected nodes.
}
\description{
These functions are for packages implementing new parsers based on the ts
package. It is very unlikely that you will need to call these functions
directly.
}
\details{
\code{ts_tree_selection()} returns the current selection, as a list
of selectors.

\code{ts_tree_selected_nodes()} returns the ids of the currently
selected nodes.
}
\examples{
\dontshow{if (requireNamespace("tsjsonc", quietly = TRUE)) withAutoprint(\{ # examplesIf}
# Create a parse tree with tsjsonc -------------------------------------
tree <- tsjsonc::ts_parse_jsonc('{"a": 13, "b": [1, 2, 3], "c": "x"}')
tree <- ts_tree_select(tree, "b", -1)
ts_tree_selection(tree)
\dontshow{\}) # examplesIf}
}
