mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
fix: warn when user uninstalls parser than is in their ensure_installed
Fixes #2777
This commit is contained in:
parent
11a8812a47
commit
d011532d73
2 changed files with 15 additions and 0 deletions
|
|
@ -401,6 +401,7 @@ function M.setup(user_data)
|
|||
end
|
||||
|
||||
config.modules.ensure_installed = nil
|
||||
config.ensure_installed = ensure_installed
|
||||
|
||||
recurse_modules(function(_, _, new_path)
|
||||
local data = utils.get_at_path(config.modules, new_path)
|
||||
|
|
@ -578,4 +579,8 @@ function M.get_ignored_parser_installs()
|
|||
return config.ignore_install or {}
|
||||
end
|
||||
|
||||
function M.get_ensure_installed_parsers()
|
||||
return config.ensure_installed or {}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -489,6 +489,16 @@ function M.uninstall(...)
|
|||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
|
||||
if vim.tbl_contains(configs.get_ensure_installed_parsers(), lang) then
|
||||
vim.notify(
|
||||
"Uninstalling "
|
||||
.. lang
|
||||
.. '. But the parser is still configured in "ensure_installed" setting of nvim-treesitter.'
|
||||
.. " Please consider updating your config!",
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
end
|
||||
|
||||
local parser_lib = utils.join_path(install_dir, lang) .. ".so"
|
||||
local all_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true)
|
||||
if vim.fn.filereadable(parser_lib) == 1 then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue