Noir grammar and parser for tree-sitter
To use with Emacs; use the following package here.
To use this parser with current nvim-treesitter, register the custom parser in
the User TSUpdate hook, make sure Neovim recognizes .nr files as noir,
and start tree-sitter highlighting for that filetype:
vim.api.nvim_create_autocmd("User", {
pattern = "TSUpdate",
callback = function()
require("nvim-treesitter.parsers").noir = {
install_info = {
url = "https://github.com/hhamud/tree-sitter-noir",
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
queries = "queries/neovim",
},
}
end,
})
vim.filetype.add({
extension = {
nr = "noir",
},
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "noir",
callback = function(args)
vim.treesitter.start(args.buf, "noir")
},
})Then run :TSInstall noir.
If you are on an older nvim-treesitter version that does not support the
queries key in install_info, copy
queries/neovim/highlights.scm into your Neovim queries/noir/ runtime
directory manually.
To install the grammar from NPM
npm i tree-sitter-noirTo install the grammar from cargo
cargo add tree-sitter-noirContributions to tree-sitter-noir are welcome. If you find any issues or have suggestions for improvement, please create a new issue or submit a pull request on the GitHub repository.