1 unstable release

0.0.4 Jul 30, 2024

#200 in Text editors

MIT license

130KB
3.5K SLoC

C 3.5K SLoC JavaScript 191 SLoC // 0.0% comments Scheme 41 SLoC // 0.1% comments Rust 29 SLoC // 0.3% comments

tree-sitter-perm

Syntax highlighting support for the Perm authorization language used by Permify for tree-sitter

Status

I believe the grammar and highlights are complete. Checked against the mercury and notion examples from the permify docs. If there are some nasty perm files that you have that this isn't working for, let me know and I'll work on getting it working correctly (or open a issue/PR).

TODOs

  • Add tests for all the rules
  • Add tests for highlighting
  • Add CONTRIBUTING doc
  • Add how to run and test locally

Usage

Neovim

Manual Installation

In your lua configs for treesitter, you need to register the perm file extension with Neovim and manually configure the parser with nvim-treesitter. You can add the snippet below to your config:

vim.filetype.add({
    extension = {
        perm = "perm",
    }
})

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.perm = {
  install_info = {
    url = 'https://github.com/theoriginalstove/tree-sitter-perm', -- local path or git repo
    files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
  },
}

vim.treesitter.language.register('perm','perm')

Then source your config or reload Neovim and run :TSInstall perm

Syntax highlighting should then be enabled for .perm files

Zed

Follow the manual install instructions in the Perm Zed Extension repo

Helix

[!note] TODO: Add instructions to installing parser to Helix text editor

GNU Emacs

[!note] TODO: Add instructions to installing parser to Emacs text editor

Dependencies

~2.8–4MB
~78K SLoC