@@ -16,9 +16,12 @@ local config = require('tree-sitter-manager.config')
1616vim .fn .mkdir (config .cfg .parser_dir , ' p' )
1717vim .fn .mkdir (config .cfg .query_dir , ' p' )
1818
19- local pending = 0
2019local failed = {}
2120
21+ -- Install serially: parallel installs cause shared dependencies (e.g. ecma,
22+ -- typescript) to be re-cloned and re-built once per dependent parser, since
23+ -- installer.install does not dedupe in-flight work. Sequential lets each
24+ -- finished parser short-circuit the next one's dep checks.
2225for _ , lang in ipairs (langs ) do
2326 local already
2427 if installer .is_only_query (lang ) then
@@ -27,22 +30,16 @@ for _, lang in ipairs(langs) do
2730 already = vim .uv .fs_stat (util .ppath (lang )) ~= nil
2831 end
2932 if not already then
30- pending = pending + 1
33+ local done = false
34+ local result_success = false
3135 installer .install (lang , function (success )
32- if not success then table.insert ( failed , lang ) end
33- pending = pending - 1
36+ result_success = success
37+ done = true
3438 end )
35- end
36- end
37-
38- if pending == 0 then
39- print (' all parsers already installed' )
40- else
41- print (' waiting on ' .. pending .. ' parser install(s)...' )
42- local done = vim .wait (600000 , function () return pending == 0 end , 200 )
43- if not done then
44- io.stderr :write (' timeout: ' .. pending .. ' install(s) still pending\n ' )
45- vim .cmd (' cq' )
39+ local ok_wait = vim .wait (300000 , function () return done end , 100 )
40+ if not ok_wait or not result_success then
41+ table.insert (failed , lang )
42+ end
4643 end
4744end
4845
0 commit comments