From 9860fceb73eb85a9ad424513fe163e6506dfb1fd Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Tue, 19 Sep 2023 17:20:26 -0400 Subject: 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`. --- lua/nvim-treesitter/install.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'lua') diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 82d233e20..0a7a9ae3d 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -555,6 +555,7 @@ end function M.setup_auto_install() vim.api.nvim_create_autocmd("FileType", { pattern = { "*" }, + group = vim.api.nvim_create_augroup("NvimTreesitter-auto_install", { clear = true }), callback = function() local lang = parsers.get_buf_lang() if parsers.get_parser_configs()[lang] and not is_installed(lang) and not is_ignored_parser(lang) then -- cgit v1.2.3-70-g09d2