mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 02:40:09 -04:00
fix: use augroup for auto_install autocmds
Problem: The FileType autocmd to automatically install parsers on a new filetype (introduced in #3130) did not have augroup. As a result, when `ts_configs.setup{ }` is called multiple times (for some reason), duplicated installation requests will be made. Solution: Use augroup with `clear = true`.
This commit is contained in:
parent
96f190f7a1
commit
9860fceb73
1 changed files with 1 additions and 0 deletions
|
|
@ -555,6 +555,7 @@ end
|
||||||
function M.setup_auto_install()
|
function M.setup_auto_install()
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = { "*" },
|
pattern = { "*" },
|
||||||
|
group = vim.api.nvim_create_augroup("NvimTreesitter-auto_install", { clear = true }),
|
||||||
callback = function()
|
callback = function()
|
||||||
local lang = parsers.get_buf_lang()
|
local lang = parsers.get_buf_lang()
|
||||||
if parsers.get_parser_configs()[lang] and not is_installed(lang) and not is_ignored_parser(lang) then
|
if parsers.get_parser_configs()[lang] and not is_installed(lang) and not is_ignored_parser(lang) then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue