add init tree-sitter command
This commit is contained in:
parent
b539703965
commit
26d8aac941
2 changed files with 11 additions and 2 deletions
12
Makefile
12
Makefile
|
@ -1,11 +1,19 @@
|
||||||
|
TS_CONF := $$HOME/.config/tree-sitter/config.json
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
tree-sitter test
|
tree-sitter test
|
||||||
|
|
||||||
highlight:
|
highlight: build
|
||||||
tree-sitter highlight -t test/highlight/*.d2
|
tree-sitter highlight -t test/highlight/*.d2
|
||||||
|
|
||||||
build:
|
build:
|
||||||
tree-sitter generate
|
tree-sitter generate
|
||||||
|
|
||||||
|
init:
|
||||||
|
if [ ! -f "$(TS_CONF)" ]; then \
|
||||||
|
tree-sitter init-config; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z $$(jq '."parser-directories"' $(TS_CONF) | grep $$(dirname $$PWD) ) ]; then \
|
||||||
|
jq ".\"parser-directories\" |= . + [\"$$(dirname $$PWD)\"]" $(TS_CONF) > $(TS_CONF); \
|
||||||
|
fi
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
jq
|
||||||
nodejs-18_x
|
nodejs-18_x
|
||||||
tree-sitter
|
tree-sitter
|
||||||
nodePackages.eslint
|
nodePackages.eslint
|
||||||
|
|
Loading…
Reference in a new issue