feat: add option to auto-install missing parsers (#3130)

This commit is contained in:
Jonas Strittmatter 2022-07-08 09:36:54 +02:00 committed by GitHub
parent 8f13ef1563
commit 365f0eb75f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 1 deletions

View file

@ -425,6 +425,18 @@ local function install(options)
end
end
function M.setup_auto_install()
vim.api.nvim_create_autocmd("FileType", {
pattern = { "*" },
callback = function()
local lang = parsers.get_buf_lang()
if parsers.get_parser_configs()[lang] and not parsers.has_parser(lang) then
install { ask_reinstall = true } { lang }
end
end,
})
end
function M.update(options)
options = options or {}
return function(...)