tree-sitter/docs/src/7-playground.md
ObserverOfTime eb5ad7eb26 feat(playground): add a button to copy the tree
Co-Authored-By: Firas al-Khalil <firasalkhalil@gmail.com>
2025-08-25 10:21:48 +03:00

4.5 KiB

Syntax Tree Playground

Code

Bash
C
C++
C#
Go
HTML
Java
JavaScript
PHP
Python
Ruby
Rust
TOML
TypeScript
YAML
Bash C C++ C# Go HTML Java JavaScript PHP Python Ruby Rust TOML TypeScript YAML

Query

Tree


About

You can try out tree-sitter with a few pre-selected grammars on this page. You can also run playground locally (with your own grammar) using the CLI's tree-sitter playground subcommand.

Logging (if enabled) can be viewed in the browser's console.

The syntax tree should update as you type in the code. As you move around the code, the current node should be highlighted in the tree; you can also click any node in the tree to select the corresponding part of the code.

You can enter one or more patterns into the Query panel. If the query is valid, its captures will be highlighted both in the Code and in the Query panels. Otherwise the problematic parts of the query will be underlined, and detailed diagnostics will be available on hover. Note that to see any results you must use at least one capture, like (node_name) @capture-name