Roc grammar for tree-sitter. Forked from faldor20/tree-sitter-roc
Example configuration. See Adding new languages to Helix
[language-server.roc-ls]
command = "roc_lang_server"
[[language]]
name = "roc"
scope = "source.roc"
injection-regex = "roc"
file-types = ["roc"]
shebangs = ["roc"]
roots = []
comment-token = "#"
language-servers = ["roc-ls"]
indent = { tab-width = 2, unit = " " }
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
[[grammar]]
name = "roc"
source.git = "https://github.com/adkelley/tree-sitter-roc"
source.rev = "<<sha hash of the latest commit goes here>>"
After updating your language.toml
file. Do the following:
- Build up on the shell
$ hx -g fetch
$ hx -g build
- Make a queries directory and copy the query files to this directory.
$ mkdir -p $HELIX/runtime/queries/roc # make your queries directory for roc
$ cp -r $HELIX/runtime/grammars/sources/roc/queries $HELIX/runtime/queries/roc
Note $HELIX
typically points to ~/.config/helix
Add the code in neovim/roc.lua
to your config somewhere.
Copy the folder neovim/queries
to your neovim config at after/
or in a custom neovim plugin at its root directory ./
eg: after/queries/roc/highlights.lua
or my_roc_plugin/queries/roc/highlights.lua
A package providing a major mode for Roc is under development.
Creating language parsers is not for the faint of heart. However, if you must, see Creating parsers to get started.
You will need:
- The tree-sitter cli, which will be installed when you run
npm install
- A c compiler like gcc or clang
Once you've made a change, to test it, run:
tree-sitter generate
tree-sitter test
If you add a new feature you should add a test to one of the test files in test/corpus/*.txt
once you are happy with you changes run
tree-sitter test --update
and it will update the test files with your new parsed tree