diff options
| author | Crony Akatsuki <crony@cronyakatsuki.xyz> | 2025-10-21 21:04:19 +0200 |
|---|---|---|
| committer | Crony Akatsuki <crony@cronyakatsuki.xyz> | 2025-10-21 21:04:19 +0200 |
| commit | 5501a8027a263ee345f405f858854ad5e50efea7 (patch) | |
| tree | 1c9680b781bbbbe600e5520d5d076a93f9f382ea /lua/plugins/treesitter.lua | |
| parent | b27714866fce8f00621b12b5baf9611c3c930bba (diff) | |
| download | nvim-5501a8027a263ee345f405f858854ad5e50efea7.zip nvim-5501a8027a263ee345f405f858854ad5e50efea7.tar.gz | |
feat(pack): run TSUpdate when updating treesitter
Diffstat (limited to 'lua/plugins/treesitter.lua')
| -rw-r--r-- | lua/plugins/treesitter.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index cdf9800..732bc58 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -21,3 +21,21 @@ require("nvim-treesitter.configs").setup({ }, }, }) + +-- run tsupdate when updating nvim-treesitter +vim.api.nvim_create_autocmd('PackChanged', { + desc = 'Handle nvim-treesitter updates', + group = vim.api.nvim_create_augroup('nvim-treesitter-pack-changed-update-handler', { clear = true }), + callback = function(event) + if event.data.kind == 'update' and event.data.spec.name == 'nvim-treesitter' then + vim.notify('nvim-treesitter updated, running TSUpdate...', vim.log.levels.INFO) + ---@diagnostic disable-next-line: param-type-mismatch + local ok = pcall(vim.cmd, 'TSUpdate') + if ok then + vim.notify('TSUpdate completed successfully!', vim.log.levels.INFO) + else + vim.notify('TSUpdate command not available yet, skipping', vim.log.levels.WARN) + end + end + end, +}) |
