:Release Notes: - fixed get_usages bug. query awaited python, why value was installed to Python - added new method in minimal single file example, to search every value installed to some field - in TUI removed redundant input handler :Detailed Notes: - :Testing Performed: - manual testing :QA Notes: - :Issues Addressed: -
43 lines
886 B
Markdown
43 lines
886 B
Markdown
# Tree sitter Seminar
|
|
|
|
## Prerequisites
|
|
|
|
```bash
|
|
$ python3 -m venv .venv
|
|
$ source .venv/bin/activate
|
|
$ pip install -r requirements.txt
|
|
```
|
|
|
|
## Launch
|
|
|
|
```bash
|
|
$ source .venv/bin/activate
|
|
$ python3 src/ts-example
|
|
```
|
|
|
|
## TUI usage
|
|
|
|
Start the TUI (the required `--file` argument can be the file you intend to
|
|
inspect):
|
|
|
|
```bash
|
|
$ python3 src/ts-example --tui minimal --file path/to/file.py
|
|
```
|
|
|
|
At the prompt, load a file and then inspect grammar fields:
|
|
|
|
```text
|
|
> read_file path/to/file.py
|
|
> find_field_values function_definition name
|
|
```
|
|
|
|
`find_field_values <node_type> <field_name>` walks every matching node and
|
|
prints the named field and its location. Node and field names are
|
|
language-grammar-specific. For example, C++ class names can be found with:
|
|
|
|
```text
|
|
> find_field_values class_specifier name
|
|
```
|
|
|
|
Other available commands include `dump_tree` and `get_usages <function>`.
|