Skip to content

Commit cb5da99

Browse files
committed
Add info about contributing to README
1 parent 5526c42 commit cb5da99

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ SCOPE_LISTS=$(addsuffix .md,$(addprefix scope-lists/,$(SYNTAXES)))
66

77
.PHONY: all test publish package
88

9-
all: $(JSON_TARGETS) $(SCOPE_LISTS)
9+
all: grammars scopes
10+
11+
grammars: $(JSON_TARGETS)
12+
13+
scopes: $(SCOPE_LISTS)
1014

1115
scope-lists/%.md: scope-lists/%.yaml
1216
scope-lists/refresh.hs md $< $@
1317

1418
scope-lists/%.yaml: syntaxes/%.YAML-tmLanguage
1519
scope-lists/refresh.hs db $< $@
1620

17-
test: all
21+
test: grammars
1822
cd test && bash test.sh
1923

2024
%.json: %.YAML-tmLanguage

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## For changes related to the grammar
22

33
- Please add a test case.
4-
4+
55
- For changes to regular Haskell code simply add a new section to `test/syntax-examples/test.hs`.
66
Make sure your case has a descriptive comment about what it is covering.
77

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,24 @@ extension or if there are further scope assigments you'd like to see added.
4545
We now publish an automatically generated, complete list of the textmate scopes
4646
used in our grammars. You can find the lists of scopes in the
4747
[scope-lists](/scope-lists) directory.
48+
49+
## Contributing
50+
51+
This project currently uses the `YAML-tmLanguage` format for language grammars (Haskell, Cabal, alex, happy, ...).
52+
The grammars can be found in the `syntaxes` directory.
53+
To generate `JSON` grammars (which is the format VS Code expects), we use the Node package `js-yaml` (requires `npx` in PATH):
54+
55+
```sh
56+
npx js-yaml haskell.YAML-tmLanguage > haskell.json
57+
```
58+
59+
For testing, we use the Node package `vscode-tmgrammar-test`. For instance, to generate/check
60+
the scopes of a Haskell source file, run:
61+
62+
```sh
63+
npx vscode-tmgrammar-test "-s" "source.haskell" "-g" "syntaxes/haskell.json" "-t" "myTestFile.hs"
64+
```
65+
66+
67+
To run the test-suite, simply call `make test`.
68+
This will build the grammar files and run `vscode-tmgrammar-test` on all the files in the testsuite.

test/test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ runTests () {
5959
expectBroken=1
6060
fi
6161
done
62-
62+
6363
# Set the appropriate syntax file for the test.
6464
case $ext in
65-
65+
6666
"hs" | "hs-boot" | "hsig" )
6767
syntaxes=( "$baseDir/syntaxes/haskell.json" )
6868
source="source.haskell"
6969
;;
70-
70+
7171
"cabal" )
7272
syntaxes=( "$baseDir/syntaxes/cabal.json" )
7373
source="source.cabal"
@@ -94,7 +94,7 @@ runTests () {
9494
;;
9595

9696
esac
97-
97+
9898
if [ ${#syntaxes[@]} -eq 0 ]
9999
then
100100
echo "runTests: $file has unsupported file extension '$ext', ignoring"

0 commit comments

Comments
 (0)