Tree sitter parser for the Motoko programming language.
Motoko is the language of the Internet Computer, a web3 platform that serves HTTP requests through distributed, containerized applications called canisters.
In addition to the normal nvim.treesitter config, add the following:
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.motoko = {
install_info = {
url = 'https://github.com/f0i/tree-sitter-motoko', -- local path or git repo
files = { 'src/parser.c', 'src/scanner.c' }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
branch = 'main', -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
}
vim.filetype.add { extension = { mo = 'motoko' } }
And copy the queries to the rtp.
mkdir -p ~/.config/nvim/queries/motoko/
cp queries/motoko/* ~/.config/nvim/queries/motoko/
The grammar is based on polychromatist/tree-sitter-motoko.
Current Motoko Grammer: Motoko Grammar. A copy of this file is located in specs/grammar.txt