class

TreeSitter::Tree

Inherits Reference / Object

A Tree represents the syntax tree of an entire source code file. It contains Node instances that indicate the structure of the source code. It can also be edited and used to produce a new Tree in the event that the source code changes.

Instance methods

changed_ranges(old_tree : Tree) : Range::Iterator
Source
copy

Create a shallow copy of the syntax tree. This is very fast.

You need to copy a syntax tree in order to use it on more than one thread at a time, as syntax trees are not thread safe.

Source
root_node

Get the root node of the syntax tree.

Source
save_dot(io : IO::FileDescriptor)

Write a DOT graph describing the syntax tree to the given file.

Source
save_dot(file : Path | String)

Write a DOT graph describing the syntax tree to the given file.

Source
save_png(file : Path | String) : Nil

Write a PNG graph describing the syntax tree to the given file.

Source