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

Commit 9eaf8ca

Browse files
author
Hendrik van Antwerpen
committed
Add getting started section to readme
1 parent c778090 commit 9eaf8ca

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
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/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

tree-sitter-stack-graphs/src/cli/init.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,14 @@ impl ProjectSettings {
308308
309309
[rustup]: https://rustup.rs/
310310
311-
312311
The project is organized as follows:
313312
314313
- The stack graph rules are defined in `src/stack-graphs.tsg`.
315314
- Builtins sources and configuration are defined in `src/builtins.{}` and `builtins.cfg` respectively.
316315
- Tests are put into the `test` directory.
317316
317+
### Building and Running Tests
318+
318319
Build the project by running:
319320
320321
``` sh
@@ -341,9 +342,15 @@ impl ProjectSettings {
341342
$ cargo fmt
342343
```
343344
344-
The stack graph rules are written in [tree-sitter-graph][], which provides a VSCode extension for syntax highlighting.
345+
### Writing TSG
346+
347+
The stack graph rules are written in [tree-sitter-graph][]. Checkout the [examples][],
348+
which contain self-contained TSG rules for specific language features. A VSCode
349+
[extension][] is available that provides syntax highlighting for TSG files.
345350
346351
[tree-sitter-graph]: https://github.com/tree-sitter/tree-sitter-graph
352+
[examples]: https://github.com/github/stack-graphs/blob/main/tree-sitter-stack-graphs/examples/
353+
[extension]: https://marketplace.visualstudio.com/items?itemName=tree-sitter.tree-sitter-graph
347354
348355
Parse and test a single file by executing the following commands:
349356
@@ -352,7 +359,7 @@ impl ProjectSettings {
352359
$ cargo run --features cli -- test TESTFILES...
353360
```
354361
355-
Additional flags can be passed to these commands as well. For example, to generate a visualization for the test, execute:
362+
Generate a visualization to debug failing tests by passing the `-V` flag:
356363
357364
``` sh
358365
$ cargo run --features cli -- test -V TESTFILES...

0 commit comments

Comments
 (0)