local jai_entry = { install_info = { url = "https://github.com/constantitus/tree-sitter-jai", files = { "src/parser.c" }, branch = "main", }, tier = 3, } -- parsers.lua is a plain table with no side effects, so loadfile is safe here. -- We need preload rather than a one-time mutation because install.lua calls -- reload_parsers() (package.loaded = nil + re-require) before checking languages. local parsers_path = vim.fn.globpath(vim.o.rtp, "lua/nvim-treesitter/parsers.lua", 0, 1)[1] package.preload["nvim-treesitter.parsers"] = function() local parsers = assert(loadfile(parsers_path))() parsers.jai = jai_entry return parsers end vim.filetype.add({ extension = { jai = "jai" } }) vim.api.nvim_create_autocmd("FileType", { pattern = "jai", callback = function() vim.treesitter.start() vim.bo.commentstring = "// %s" end, })