#tree-sitter #parser #prisma #incremental

tree-sitter-prisma-io

prisma grammar for the tree-sitter parsing library

6 stable releases

new 1.5.0 Jan 24, 2025
1.4.0 Jan 5, 2023
1.3.0 Jun 11, 2022
1.2.2 Jun 10, 2022
1.2.1 Apr 20, 2022

#67 in Text editors

Download history 55/week @ 2024-10-07 11/week @ 2024-10-14 6/week @ 2024-10-21 20/week @ 2024-10-28 6/week @ 2024-11-04 7/week @ 2024-11-11 10/week @ 2024-11-18 7/week @ 2024-11-25 9/week @ 2024-12-02 38/week @ 2024-12-09 5/week @ 2024-12-16 1/week @ 2024-12-23 1/week @ 2025-01-13 98/week @ 2025-01-20

99 downloads per month

MIT license

250KB
10K SLoC

C 9K SLoC JavaScript 280 SLoC Rust 31 SLoC // 0.5% comments Scheme 23 SLoC

Tree Sitter Prisma

semantic-release

Introduction

This is an unofficial Prisma language parsing. More information about the language and specs can be found here:

If you notice any bug or problem, please submit an issue or make a pull request. Any contribution is welcomed and needed.

Development

Requirements:

  • Rust >= 1.84
  • node >= 22

All the parsing logic is specified in grammar.js at the root level. To see if the changes made to it are working, run the tests and compare the results.

npm test

A playground is also available to test the parser (though it needs Docker to run)

npm start

More information about how to write or use the tree parser can be found here: http://tree-sitter.github.io/tree-sitter/

Many parts of the code were scavenged from these repositories:

I'm grateful to the authors and contributors of those repositories, without them this parser would be a lot times worse. Thank you for having such a good documentation and code.

Neovim Usage

For neovim users, nvim-treesitter is needed, please make sure it is installed.

A typical installation using vim-plug would be like following

call plug#begin()

" ... Any other plugins

Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

call plug#end()

lua <<EOF
require'nvim-treesitter.configs'.setup {
  ensure_installed = { "prisma" }, -- You can add other languages too
  sync_install = false,
  auto_install = true,
  highlight = {
    enable = true,
  },
}
EOF

And don't forget to run the following in nvim

:TSInstall

Dependencies

~2.8–4MB
~79K SLoC