local lazy = require("lazy") local Plugin = require("lazy.core.plugin") local dir, ts for _, p in ipairs(lazy.plugins()) do if p.name == "nvim-treesitter" then dir, ts = p.dir, p break end end vim.opt.runtimepath:append(dir) local ensure = Plugin.values(ts, "opts", false).ensure_installed or {} local TS = require("nvim-treesitter") local installed = TS.get_installed("parsers") local missing = vim.tbl_filter(function(l) return not vim.list_contains(installed, l) end, ensure) if #missing > 0 then print("[precompile] installing treesitter parsers: " .. table.concat(missing, ", ")) local ok, err = pcall(function() TS.install(missing, { summary = true }):wait() end) if not ok then print("[precompile] warning: " .. tostring(err)) end else print("[precompile] all ensure_installed parsers already present") end vim.cmd("qa")