#tree-sitter #pact #incremental #smart-contracts #parser

tree-sitter-pact

pact grammar for the tree-sitter parsing library

4 releases

0.0.8 Nov 22, 2024
0.0.7 Sep 21, 2024
0.0.6 Sep 21, 2024
0.0.1 Sep 21, 2024

#129 in Text editors

Download history 381/week @ 2024-09-21 57/week @ 2024-09-28 4/week @ 2024-10-05 85/week @ 2024-11-16 56/week @ 2024-11-23 11/week @ 2024-11-30

152 downloads per month

MIT license

280KB
11K SLoC

C 10K SLoC JavaScript 375 SLoC // 0.0% comments Scheme 198 SLoC // 0.0% comments Rust 31 SLoC // 0.5% comments

tree-sitter-pact

tree-sitter grammar for pact smart contract language

Neovim setup (WIP)

I will create a PR to add this to the official nvim-treesitter repo once it's ready, for now you can use it by following these steps:

Clone the repo

git clone https://github.com/kadena-community/tree-sitter-pact.git

Add those to your init.lua

vim.filetype.add({
  extension = {
    pact = "pact",
    repl = "pact",
  },
})
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.pact = {
  install_info = {
    url = "~/path/to/c/tree-sitter-pact",
    files = { "src/parser.c" },
  },
  filetype = "pact",
}

Then run :TSInstall pact in neovim.

also you need to link the queries folder to your nvim config folder

mkdir -p ~/.config/nvim/after/queries/pact
ln ./queries/highlights.scm ~/.config/nvim/after/queries/pact/highlights.scm
ln ./queries/locals.scm ~/.config/nvim/after/queries/pact/locals.scm
ln ./queries/textobjects.scm ~/.config/nvim/after/queries/pact/textobjects.scm
ln ./queries/folds.scm ~/.config/nvim/after/queries/pact/folds.scm
ln ./queries/indents.scm ~/.config/nvim/after/queries/pact/indents.scm

Dependencies

~2–305KB