From 3ea0ee78de4d6617bcf46664fca96c12b3697fcb Mon Sep 17 00:00:00 2001 From: przepompownia Date: Wed, 5 Mar 2025 20:03:30 +0100 Subject: [PATCH] feat(install): allow pass callback to `update()` Problem: cannot run `:TSUpdate synchronously` Solution: pass callback used after exiting jobs (like in `install-parsers`). --- lua/nvim-treesitter/install.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index c2a5ea396..0718f8eba 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -455,8 +455,8 @@ end, 3) ---@param languages? string[]|string ---@param _options? UpdateOptions ----@param _callback function -M.update = a.sync(function(languages, _options, _callback) +---@param callback function +M.update = a.sync(function(languages, _options, callback) reload_parsers() if not languages or #languages == 0 then languages = 'all' @@ -465,7 +465,7 @@ M.update = a.sync(function(languages, _options, _callback) languages = vim.tbl_filter(needs_update, languages) ---@type string[] if #languages > 0 then - install(languages, { force = true }) + install(languages, { force = true }, callback) else log.info('All parsers are up-to-date') end