mirror of
https://github.com/nvim-treesitter/nvim-treesitter
synced 2024-09-16 14:34:05 +02:00
feat!: update tier 1 parsers to versions
This commit is contained in:
parent
b2d17c61dd
commit
1058d80eba
1 changed files with 27 additions and 10 deletions
|
@ -8,9 +8,21 @@ local updates = {} ---@type string[]
|
|||
|
||||
-- check for new revisions
|
||||
for k, p in pairs(parsers) do
|
||||
if p.tier < 5 and p.install_info then
|
||||
if p.install_info then
|
||||
print('Updating ' .. k)
|
||||
jobs[k] = vim.system({ 'git', 'ls-remote', p.install_info.url })
|
||||
local cmd = p.tier == 1
|
||||
and {
|
||||
'git',
|
||||
'-c',
|
||||
'versionsort.suffix=-',
|
||||
'ls-remote',
|
||||
'--tags',
|
||||
'--refs',
|
||||
'--sort=v:refname',
|
||||
p.install_info.url,
|
||||
}
|
||||
or { 'git', 'ls-remote', p.install_info.url }
|
||||
jobs[k] = vim.system(cmd)
|
||||
end
|
||||
|
||||
if #vim.tbl_keys(jobs) % 100 == 0 or next(parsers, k) == nil then
|
||||
|
@ -21,18 +33,23 @@ for k, p in pairs(parsers) do
|
|||
local info = parsers[name].install_info
|
||||
assert(info)
|
||||
|
||||
local branch = info.branch
|
||||
local line = 1
|
||||
if branch then
|
||||
for j, l in ipairs(stdout) do
|
||||
if l:find(vim.pesc(branch)) then
|
||||
line = j
|
||||
break
|
||||
local sha ---@type string
|
||||
if parsers[name].tier == 1 then
|
||||
sha = stdout[#stdout - 1]:match('v[%d%.]+$')
|
||||
else
|
||||
local branch = info.branch
|
||||
local line = 1
|
||||
if branch then
|
||||
for j, l in ipairs(stdout) do
|
||||
if l:find(vim.pesc(branch)) then
|
||||
line = j
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
sha = vim.split(stdout[line], '\t')[1]
|
||||
end
|
||||
|
||||
local sha = vim.split(stdout[line], '\t')[1]
|
||||
if info.revision ~= sha then
|
||||
info.revision = sha
|
||||
updates[#updates + 1] = name
|
||||
|
|
Loading…
Reference in a new issue