mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
fix: add hint when there parser is still installed after TSUninstall
This commit is contained in:
parent
14bd391e56
commit
11a8812a47
1 changed files with 30 additions and 5 deletions
|
|
@ -490,11 +490,36 @@ function M.uninstall(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local parser_lib = utils.join_path(install_dir, lang) .. ".so"
|
local parser_lib = utils.join_path(install_dir, lang) .. ".so"
|
||||||
|
local all_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true)
|
||||||
local command_list = {
|
if vim.fn.filereadable(parser_lib) == 1 then
|
||||||
shell.select_rm_file_cmd(parser_lib, "Uninstalling parser for " .. lang),
|
local command_list = {
|
||||||
}
|
shell.select_rm_file_cmd(parser_lib, "Uninstalling parser for " .. lang),
|
||||||
M.iter_cmd(command_list, 1, lang, "Treesitter parser for " .. lang .. " has been uninstalled")
|
{
|
||||||
|
cmd = function()
|
||||||
|
local all_parsers_after_deletion = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true)
|
||||||
|
if #all_parsers_after_deletion > 0 then
|
||||||
|
vim.notify(
|
||||||
|
"Tried to uninstall parser for "
|
||||||
|
.. lang
|
||||||
|
.. "! But the parser is still installed (not by nvim-treesitter)."
|
||||||
|
.. " Please delete the following files manually: "
|
||||||
|
.. table.concat(all_parsers_after_deletion, ", "),
|
||||||
|
vim.log.levels.ERROR
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
M.iter_cmd(command_list, 1, lang, "Treesitter parser for " .. lang .. " has been uninstalled")
|
||||||
|
elseif #all_parsers > 0 then
|
||||||
|
vim.notify(
|
||||||
|
"Parser for "
|
||||||
|
.. lang
|
||||||
|
.. " is installed! But not by nvim-treesitter! Please manually remove the following files: "
|
||||||
|
.. table.concat(all_parsers, ", "),
|
||||||
|
vim.log.levels.ERROR
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue