IndianBoy42 / tree-sitter-just

Treesitter grammar for Justfiles (casey/just)
Apache License 2.0
144 stars 26 forks source link

Add support for annotations with grammar #165

Closed mkatychev closed 4 months ago

mkatychev commented 4 months ago

Recent additions to just added [annotations("with-arguments")]:

[group("foo"), group("echo")]
foo:
  echo "foo"

[doc("this is bar")]
bar:
  echo "bar"

https://just.systems/man/en/chapter_35.html https://just.systems/man/en/chapter_28.html

Fixes https://github.com/IndianBoy42/tree-sitter-just/issues/164

mkatychev commented 4 months ago

Getting some issues with npx tree-sitter:

$ just test-parse-highlight
+ '[' '!' -d ~/Documents/tree-sitter/just/repositories/just ']'
++ git -C ~/Documents/tree-sitter/just/repositories/just rev-parse HEAD
+ actual_sha=5f91b37c82e6a92df2575babcb17a6a8e9c505f7
+ '[' 5f91b37c82e6a92df2575babcb17a6a8e9c505f7 '!=' 5f91b37c82e6a92df2575babcb17a6a8e9c505f7 ']'
Checking parsing and highlighting...
Checking '~/Documents/tree-sitter/just/test/issue69-segfault.just': parse'
Unknown scope 'source.just'
Traceback (most recent call last):
  File "/var/folders/46/8kdrb66s5hg5bpjclp5wqpqh0000gn/T/just-M5x9MF/test-parse-highlight", line 208, in <module>
    sp.check_output(
  File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['npx', 'tree-sitter', 'parse', PosixPath('~/Documents/tree-sitter/just/test/issue69-segfault.just'), '--scope', 'source.just']' returned non-zero exit status 1.
error: Recipe `test-parse-highlight` failed with exit code 1
tgross35 commented 4 months ago

There are probably some issues since you are on a much newer version of TS than the rest of this repo. Working on updating that in https://github.com/IndianBoy42/tree-sitter-just/pull/166

tgross35 commented 4 months ago

Thanks for updating, could you rerun just setup (or only npm install --include=dev) and then rerun just gen; just fmt? Probably something got out of sync

tgross35 commented 4 months ago

Thank you for the PR!