You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
866 B

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")