mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 12:30:01 -04:00
parent
37b9a2971f
commit
901ffe1a36
7 changed files with 137 additions and 78 deletions
|
|
@ -80,7 +80,7 @@ local function get_revision(lang)
|
|||
end
|
||||
|
||||
local function get_installed_revision(lang)
|
||||
local lang_file = utils.join_path(utils.get_parser_info_dir(), lang .. ".revision")
|
||||
local lang_file = utils.join_path(configs.get_parser_info_dir(), lang .. ".revision")
|
||||
if vim.fn.filereadable(lang_file) == 1 then
|
||||
return vim.fn.readfile(lang_file)[1]
|
||||
end
|
||||
|
|
@ -243,9 +243,9 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
|
|||
compile_location = repo.url
|
||||
else
|
||||
local repo_location = string.gsub(repo.location or project_name, "/", path_sep)
|
||||
compile_location = cache_folder .. path_sep .. repo_location
|
||||
compile_location = utils.join_path(cache_folder, repo_location)
|
||||
end
|
||||
local parser_lib_name = install_folder .. path_sep .. lang .. ".so"
|
||||
local parser_lib_name = utils.join_path(install_folder, lang) .. ".so"
|
||||
|
||||
generate_from_grammar = repo.requires_generate_from_grammar or generate_from_grammar
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
|
|||
shell.select_mv_cmd("parser.so", parser_lib_name, compile_location),
|
||||
{
|
||||
cmd = function()
|
||||
vim.fn.writefile({ revision or "" }, utils.join_path(utils.get_parser_info_dir(), lang .. ".revision"))
|
||||
vim.fn.writefile({ revision or "" }, utils.join_path(configs.get_parser_info_dir(), lang .. ".revision"))
|
||||
end,
|
||||
},
|
||||
{ -- auto-attach modules after installation
|
||||
|
|
@ -392,7 +392,7 @@ local function install(options)
|
|||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
|
||||
local install_folder, err = utils.get_parser_install_dir()
|
||||
local install_folder, err = configs.get_parser_install_dir()
|
||||
if err then
|
||||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
|
|
@ -459,11 +459,6 @@ function M.update(options)
|
|||
end
|
||||
|
||||
function M.uninstall(...)
|
||||
local path_sep = "/"
|
||||
if fn.has "win32" == 1 then
|
||||
path_sep = "\\"
|
||||
end
|
||||
|
||||
if vim.tbl_contains({ "all" }, ...) then
|
||||
reset_progress_counter()
|
||||
local installed = info.installed_parsers()
|
||||
|
|
@ -473,12 +468,12 @@ function M.uninstall(...)
|
|||
elseif ... then
|
||||
local languages = vim.tbl_flatten { ... }
|
||||
for _, lang in ipairs(languages) do
|
||||
local install_dir, err = utils.get_parser_install_dir()
|
||||
local install_dir, err = configs.get_parser_install_dir()
|
||||
if err then
|
||||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
|
||||
local parser_lib = install_dir .. path_sep .. lang .. ".so"
|
||||
local parser_lib = utils.join_path(install_dir, lang) .. ".so"
|
||||
|
||||
local command_list = {
|
||||
shell.select_rm_file_cmd(parser_lib, "Uninstalling parser for " .. lang),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue