fix(install): don't prompt on installed parsers (skip)

Use `:TSInstall!` or `force = true` to reinstall.
This commit is contained in:
Christian Clason 2025-03-26 09:54:22 +01:00
parent 12e0246e4f
commit 9365cf8a97
3 changed files with 5 additions and 11 deletions

View file

@ -20,7 +20,7 @@ function M.setup(user_data)
if user_data then
if user_data.install_dir then
user_data.install_dir = vim.fs.normalize(user_data.install_dir)
--TODO(clason): insert after/before site, or leave to user?
--TODO(clason): leave to user!
vim.opt.runtimepath:append(user_data.install_dir)
end
config = vim.tbl_deep_extend('force', config, user_data)

View file

@ -365,12 +365,8 @@ local install_status = {} ---@type table<string,InstallStatus?>
---@return InstallStatus status
local function install_lang(lang, cache_dir, install_dir, force, generate)
if not force and vim.list_contains(config.installed_parsers(), lang) then
local yesno = fn.input(lang .. ' parser already available: would you like to reinstall ? y/n: ')
print('\n ')
if yesno:sub(1, 1) ~= 'y' then
install_status[lang] = 'installed'
return 'installed'
end
install_status[lang] = 'installed'
return 'installed'
end
if install_status[lang] then
@ -444,10 +440,6 @@ M.install = a.sync(function(languages, options, callback)
languages = config.norm_languages(languages, options and options.skip)
if languages[1] == 'all' then
options.force = true
end
install(languages, options, callback)
end, 3)