Reference it from your editor somehow. //TODO
My full config for roc is below:
[language-server.roc-ls]
command = "roc_language_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 = " " }
auto-format = true
formatter = { command = "roc", args =[ "format", "--stdin", "--stdout"]}
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
[[grammar]]
name = "roc"
source = { git = "https://github.com/faldor20/tree-sitter-roc.git", rev = "whateverTheLatestCommitIs" }- After adding the above to your
languages.toml, runhx --grammar fetchand thenhx --grammar build - Add
~/.config/helix/runtime/queries/roc/and put the files from this repository'squeriesdirectory in there. - Run
hx --health rocin a new shell and verify that your changes have been picked up correctly. If things are green, you're good to go.
Install the nvim-treesitter plugin using your favorite package manager. The Roc language is supported by nvim-treesitter. Install it with the command:
:TSInstall rocAdd 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.luaor my_roc_plugin/queries/roc/highlights.lua
A package providing a major mode for Roc is under development.
Currently i use nix for development so to start the dev environment in nix run
nix developI've had some odd issues with the system version of libc being incompatible with my version of treesitter. if tree-sitter is spitting out weird errors try running it in an isolated environments
nix develop -iIf you are outside of nix. 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 --updateand it will update the test files with your new parsed tree