Skip to content

Commit ed939ed

Browse files
authored
Merge pull request #456 from jonshea/jonshea/update-contributing-docs
Update CONTRIBUTING.md
2 parents d67fe3b + 32b6e0d commit ed939ed

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ tree-sitter.
77

88
## Requirements
99

10+
- [tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/tree/master/cli)
1011
- Node.js version 18.0 or greater
1112
- C Compiler
1213

1314
Refer to the [tree-sitter
14-
documentation](https://tree-sitter.github.io/tree-sitter/creating-parsers#dependencies)
15+
documentation](https://tree-sitter.github.io/tree-sitter/creating-parsers/1-getting-started.html)
1516
for more details and specifics.
1617

1718
If you use nix you can enter a nix-shell (`nix-shell .`) which will install them
@@ -26,16 +27,16 @@ project's dependencies:
2627
npm install
2728
```
2829

29-
The general flow will often start with adding a test case to `./corpus`. You can
30+
The general flow will often start with adding a test case to `./test/corpus`. You can
3031
find details on how testing works with tree-sitter
31-
[here](https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test).
32+
[here](https://tree-sitter.github.io/tree-sitter/creating-parsers/5-writing-tests.html).
3233

3334
Once you've added your test case you'll want to then make the required changes
3435
to `grammar.js`, regenerate and recompile the parser, and run the tests:
3536

3637
```sh
37-
npm run build
38-
npm test
38+
tree-sitter generate
39+
tree-sitter test
3940
```
4041

4142
Then adjust as necessary. Note that depending on your change you may also have
@@ -48,15 +49,18 @@ Right now the most common use-case for syntax highlight using tree-sitter is
4849
[nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter), which
4950
means much of our testing is in relation to it. You can find the syntax
5051
highlighting tests in `test/highlight/*.scala`. You can read more about this
51-
type of testing
52-
[here](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#unit-testing). These test will be automatically ran with `npm run test`.
52+
type of testing
53+
[here](https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#unit-testing).
54+
These test will be run automatically with `tree-sitter test`.
5355

5456
### tree-sitter highlight
5557

5658
Another way to test your syntax highlighting locally is to use the `tree-sitter
5759
highlight` command. Note that you'll need to have `tree-sitter` installed
5860
globally for this to work. Once you have it installed you'll want to follow the
59-
instructions [here](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#per-user-configuration) to setup a local config that points towards this repo to be used as a parser. Once done you can then do the following:
61+
instructions [here](https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#overview)
62+
to setup a local config that points towards this repo to be used as a parser.
63+
Once done you can then do the following:
6064

6165
```sh
6266
tree-sitter highlight some/scala/file.scala
@@ -102,8 +106,7 @@ Then you can copy your Scala code in a file and pass that file into `npm run
102106
parse`:
103107

104108
```
105-
npm run parse <path/to/your/file.scala>
109+
tree-sitter parse <path/to/your/file.scala>
106110
```
107111

108112
Then the tree will be printed out for you to copy.
109-

0 commit comments

Comments
 (0)