mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 03:56:52 -04:00
feat: add option to auto-install missing parsers (#3130)
This commit is contained in:
parent
8f13ef1563
commit
365f0eb75f
4 changed files with 25 additions and 1 deletions
|
|
@ -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(...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue