mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
fix(install): don't prompt on installed parsers (skip)
Use `:TSInstall!` or `force = true` to reinstall.
This commit is contained in:
parent
12e0246e4f
commit
9365cf8a97
3 changed files with 5 additions and 11 deletions
2
TODO.md
2
TODO.md
|
|
@ -4,6 +4,8 @@ This document lists the planned and finished changes in this rewrite towards [Nv
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
- [ ] **`config.lua`:** drop ensure_install (replace with install), ignore_install
|
||||||
|
- [ ] **`install.lua`:** simply skip Tier 4 parsers (`get_install_info`)
|
||||||
- [ ] **`parsers.lua`:** allow specifying version in addition to commit hash (for Tier 1)
|
- [ ] **`parsers.lua`:** allow specifying version in addition to commit hash (for Tier 1)
|
||||||
- [ ] **`parsers.lua`:** add WASM support (tier 1)
|
- [ ] **`parsers.lua`:** add WASM support (tier 1)
|
||||||
- [ ] **`install.lua`:** migrate to async v2
|
- [ ] **`install.lua`:** migrate to async v2
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ function M.setup(user_data)
|
||||||
if user_data then
|
if user_data then
|
||||||
if user_data.install_dir then
|
if user_data.install_dir then
|
||||||
user_data.install_dir = vim.fs.normalize(user_data.install_dir)
|
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)
|
vim.opt.runtimepath:append(user_data.install_dir)
|
||||||
end
|
end
|
||||||
config = vim.tbl_deep_extend('force', config, user_data)
|
config = vim.tbl_deep_extend('force', config, user_data)
|
||||||
|
|
|
||||||
|
|
@ -365,12 +365,8 @@ local install_status = {} ---@type table<string,InstallStatus?>
|
||||||
---@return InstallStatus status
|
---@return InstallStatus status
|
||||||
local function install_lang(lang, cache_dir, install_dir, force, generate)
|
local function install_lang(lang, cache_dir, install_dir, force, generate)
|
||||||
if not force and vim.list_contains(config.installed_parsers(), lang) then
|
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: ')
|
install_status[lang] = 'installed'
|
||||||
print('\n ')
|
return 'installed'
|
||||||
if yesno:sub(1, 1) ~= 'y' then
|
|
||||||
install_status[lang] = 'installed'
|
|
||||||
return 'installed'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if install_status[lang] then
|
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)
|
languages = config.norm_languages(languages, options and options.skip)
|
||||||
|
|
||||||
if languages[1] == 'all' then
|
|
||||||
options.force = true
|
|
||||||
end
|
|
||||||
|
|
||||||
install(languages, options, callback)
|
install(languages, options, callback)
|
||||||
end, 3)
|
end, 3)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue