ASTronomer 🔭 ✨
👋 Hey there!
This repo contains the source code for ASTronomer, a tool which displays TreeSitter Abstract Syntax Trees (ASTs) alongside some tools to make using them easier!
This was created out of my frustration with TreeSitter's (harder than it should be) learning curve. Hope it helps! If you would like to contribute please see the "Contributing" section below!
How it works
Sparing much of the nitty gritty details about how TreeSitter Parsing works (more here), each supported Language requires a Language WASM build. The currently supported are below in the "Supported Languages" subsection. Each of these Languages will be used to parse a document into an AST. The code for this is largely located in
To render the syntax tree we're using VS Code's built in tree view, although in the future a webview will provide more flexibility. The code for this located in
Currently there are 16 supported languages:
Adding New Languages
There are two easy ways to do this!
Copying sections of the AST
Just right click a node and select "Copy S-Expression" - the S-Expression is how TreeSitter expresses ASTs in text. These also have the nice advantage of being queryable!
Querying the AST
Note: The syntax is a bit finicky and there are many operators described in the TreeSitter docs here.
There is no need to specify an
This part of the extension is most susceptible to bugs, if you find any please open an issue!
Feel free to contribute your ideas! This was built in one person's vision, the more ideas the better!