Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit dc1c086

Browse files
author
Hendrik van Antwerpen
authored
Merge pull request #182 from github/update-init-command
Generate Cargo projects with `init`
2 parents 2e72ebc + 875defc commit dc1c086

File tree

10 files changed

+906
-256
lines changed

10 files changed

+906
-256
lines changed

languages/tree-sitter-stack-graphs-typescript/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ The project is organized as follows:
4242
- Builtins sources and configuration are defined in `src/builtins.ts` and `builtins.cfg` respectively.
4343
- Tests are put into the `test` directory.
4444

45+
### Building and Running Tests
46+
4547
Build the project by running:
4648

4749
``` sh
@@ -70,10 +72,15 @@ Sources are formatted using the standard Rust formatted, which is applied by run
7072
$ cargo fmt
7173
```
7274

73-
The stack graph rules are written in [tree-sitter-graph][], which provides a VSCode
74-
extension for syntax highlighting.
75+
### Writing TSG
76+
77+
The stack graph rules are written in [tree-sitter-graph][]. Checkout the [examples][],
78+
which contain self-contained TSG rules for specific language features. A VSCode
79+
[extension][] is available that provides syntax highlighting for TSG files.
7580

7681
[tree-sitter-graph]: https://github.com/tree-sitter/tree-sitter-graph
82+
[examples]: https://github.com/github/stack-graphs/blob/main/tree-sitter-stack-graphs/examples/
83+
[extension]: https://marketplace.visualstudio.com/items?itemName=tree-sitter.tree-sitter-graph
7784

7885
Parse and test a single file by executing the following commands:
7986

@@ -82,8 +89,7 @@ $ cargo run --features cli -- parse FILES...
8289
$ cargo run --features cli -- test TESTFILES...
8390
```
8491

85-
Additional flags can be passed to these commands as well. For example, to generate
86-
a visualization for the test, execute:
92+
Generate a visualization to debug failing tests by passing the `-V` flag:
8793

8894
``` sh
8995
$ cargo run --features cli -- test -V TESTFILES...

tree-sitter-stack-graphs/Cargo.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,32 @@ name = "tree-sitter-stack-graphs"
2222
required-features = ["cli"]
2323

2424
[features]
25-
cli = ["clap", "colored", "dialoguer", "env_logger", "indoc", "pathdiff", "stack-graphs/json", "tree-sitter-config", "walkdir"]
25+
cli = [
26+
"chrono",
27+
"clap",
28+
"colored",
29+
"dialoguer",
30+
"env_logger",
31+
"indoc",
32+
"pathdiff",
33+
"stack-graphs/json",
34+
"tree-sitter-config",
35+
"walkdir"
36+
]
2637

2738
[dependencies]
2839
anyhow = "1.0"
40+
chrono = { version = "0.4", optional = true }
2941
clap = { version = "3", optional = true, features=["derive"] }
3042
colored = { version = "2.0", optional = true }
3143
controlled-option = ">=0.4"
3244
dialoguer = { version = "0.10", optional = true }
3345
env_logger = { version = "0.9", optional = true }
3446
indoc = { version = "1.0", optional = true }
3547
itertools = "0.10"
36-
lazy_static = "1.4"
3748
log = "0.4"
3849
lsp-positions = { version="0.3", path="../lsp-positions" }
50+
once_cell = "1"
3951
pathdiff = { version = "0.2.1", optional = true }
4052
regex = "1"
4153
rust-ini = "0.18"

tree-sitter-stack-graphs/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,22 @@ Alternatively, the program can be invoked via NPM as follows:
3939
$ npx tree-sitter-stack-graphs
4040
```
4141

42-
Check out our [examples](https://github.com/github/stack-graphs/blob/main/tree-sitter-stack-graphs/examples/) for more details on how to work with the CLI.
42+
## Getting Started
43+
44+
Starting a new project to develop stack graph definitions for your favourite language
45+
is as easy as running the `init` command:
46+
47+
``` sh
48+
$ tree-sitter-stack-graphs init PROJECT_DIR
49+
```
50+
51+
Answer the questions to provide information about the language, the grammar dependency, and
52+
the project and hit `Generate` to generate the new project. Check out `PROJECT_DIR/README.md`
53+
to find out how to start developing.
54+
55+
Also check out our [examples][] for more details on how to work with the CLI.
56+
57+
[examples]: https://github.com/github/stack-graphs/blob/main/tree-sitter-stack-graphs/examples/
4358

4459
## Development
4560

0 commit comments

Comments
 (0)