feat(pack): run TSUpdate when updating treesitter
This commit is contained in:
parent
b27714866f
commit
5501a8027a
1 changed files with 18 additions and 0 deletions
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue