TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
playground command starts a local playground to test your parser interactively in a web browser.
play, pg, web-ui
Features
The playground provides:- Live parsing - See the syntax tree update as you type
- Query testing - Test Tree-sitter queries in real-time
- Syntax highlighting - View highlighted output
- Error visualization - Easily spot parse errors
Options
Don’t automatically open the playground in the default browser. The server will still start and you can manually open the URL.
The path to the directory containing the grammar and Wasm files.
Export static playground files to the specified directory instead of serving them. This allows you to host the playground as a static site.
Examples
Start Playground
- Start a local web server
- Open the playground in your default browser
- Load your parser from the Wasm file
Start Without Opening Browser
http://localhost:3000).
Export Static Files
Playground with Custom Grammar Path
Workflow
Typical development workflow with the playground:-
Make changes to your grammar:
-
Regenerate and build:
-
Test in playground:
- Iterate until satisfied
Troubleshooting
Wasm Module Not Found
If you see “Wasm module not found” errors:Playground Not Updating
If changes aren’t reflected:- Rebuild the Wasm module
- Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)
- Clear browser cache if needed