fix(install): return error code in callback

This commit is contained in:
Christian Clason 2024-10-12 20:14:21 +02:00
parent a2841d29d7
commit aaf5b7fdf7
9 changed files with 202 additions and 188 deletions

View file

@ -33,6 +33,7 @@ Language | Tier | Queries | Maintainer
[cairo](https://github.com/tree-sitter-grammars/tree-sitter-cairo) | core | `HFIJL` | @amaanq
[capnp](https://github.com/tree-sitter-grammars/tree-sitter-capnp) | core | `HFIJL` | @amaanq
[chatito](https://github.com/tree-sitter-grammars/tree-sitter-chatito) | core | `HFIJL` | @ObserverOfTime
[circom](https://github.com/Decurity/tree-sitter-circom) | community | `HF JL` | @alexandr-martirosyan
[clojure](https://github.com/sogaiu/tree-sitter-clojure) | community | `HF JL` | @NoahTheDuke
[cmake](https://github.com/uyha/tree-sitter-cmake) | community | `HFIJ ` | @uyha
[comment](https://github.com/stsewd/tree-sitter-comment) | community | `H    ` | @stsewd
@ -45,8 +46,10 @@ Language | Tier | Queries | Maintainer
[csv](https://github.com/tree-sitter-grammars/tree-sitter-csv) | core | `H    ` | @amaanq
[cuda](https://github.com/tree-sitter-grammars/tree-sitter-cuda) | core | `HFIJL` | @theHamsta
[cue](https://github.com/eonpatapon/tree-sitter-cue) | community | `HFIJL` | @amaanq
[cylc](https://github.com/elliotfontaine/tree-sitter-cylc) | community | `HFIJ ` | @elliotfontaine
[d](https://github.com/gdamore/tree-sitter-d) | community | `HFIJL` | @amaanq
[dart](https://github.com/UserNobody14/tree-sitter-dart) | community | `HFIJL` | @akinsho
[desktop](https://github.com/ValdezFOmar/tree-sitter-desktop) | community | `HF J ` | @ValdezFOmar
[devicetree](https://github.com/joelspadin/tree-sitter-devicetree) | community | `HFIJL` | @jedrzejboczar
[dhall](https://github.com/jbellerb/tree-sitter-dhall) | community | `HF J ` | @amaanq
[diff](https://github.com/the-mikedavis/tree-sitter-diff) | community | `HF J ` | @gbprod
@ -106,6 +109,7 @@ ecma (queries only)[^ecma] | community | `HFIJL` | @steelsojka
[gowork](https://github.com/omertuc/tree-sitter-go-work) | community | `H  J ` | @omertuc
[gpg](https://github.com/tree-sitter-grammars/tree-sitter-gpg-config) | core | `H  J ` | @ObserverOfTime
[graphql](https://github.com/bkegley/tree-sitter-graphql) | community | `H IJ ` | @bkegley
[gren](https://github.com/MaeBrooks/tree-sitter-gren) | community | `H  J ` | @MaeBrooks
[groovy](https://github.com/murtaza64/tree-sitter-groovy) | community | `HFIJL` | @murtaza64
[gstlaunch](https://github.com/tree-sitter-grammars/tree-sitter-gstlaunch) | core | `H    ` | @theHamsta
[hack](https://github.com/slackhq/tree-sitter-hack) | unsupported | `H  J ` |
@ -123,12 +127,14 @@ ecma (queries only)[^ecma] | community | `HFIJL` | @steelsojka
[html](https://github.com/tree-sitter/tree-sitter-html) | core | `HFIJL` | @TravonteD
html_tags (queries only)[^html_tags] | community | `H IJ ` | @TravonteD
[htmldjango](https://github.com/interdependence/tree-sitter-htmldjango) | community | `HFIJ ` | @ObserverOfTime
[http](https://github.com/rest-nvim/tree-sitter-http) | community | `H  J ` | @amaanq, @NTBBloodbath
[http](https://github.com/rest-nvim/tree-sitter-http) | community | `HF J ` | @amaanq, @NTBBloodbath
[hurl](https://github.com/pfeiferj/tree-sitter-hurl) | community | `HFIJ ` | @pfeiferj
[hyprlang](https://github.com/tree-sitter-grammars/tree-sitter-hyprlang) | core | `HFIJ ` | @luckasRanarison
[idl](https://github.com/cathaysia/tree-sitter-idl) | community | `H IJ ` | @cathaysia
[idris](https://github.com/kayhide/tree-sitter-idris) | community | `     ` | @srghma
[ini](https://github.com/justinmk/tree-sitter-ini) | community | `HF J ` | @theHamsta
[inko](https://github.com/inko-lang/tree-sitter-inko) | community | `HFIJL` | @yorickpeterse
[ipkg](https://github.com/srghma/tree-sitter-ipkg) | community | `HFIJL` | @srghma
[ispc](https://github.com/tree-sitter-grammars/tree-sitter-ispc) | core | `HFIJL` | @fab4100
[janet_simple](https://github.com/sogaiu/tree-sitter-janet-simple) | community | `HF JL` | @sogaiu
[java](https://github.com/tree-sitter/tree-sitter-java) | core | `HFIJL` | @p00f
@ -140,7 +146,7 @@ html_tags (queries only)[^html_tags] | community | `H IJ ` | @TravonteD
[jsonc](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc) | community | `HFIJL` | @WhyNotHugo
[jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) | community | `HF JL` | @nawordar
jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[julia](https://github.com/tree-sitter/tree-sitter-julia) | core | `HFIJL` | @theHamsta
[julia](https://github.com/tree-sitter/tree-sitter-julia) | community | `HFIJL` | @fredrikekre
[just](https://github.com/IndianBoy42/tree-sitter-just) | community | `HFIJL` | @Hubro
[kconfig](https://github.com/tree-sitter-grammars/tree-sitter-kconfig) | core | `HFIJL` | @amaanq
[kdl](https://github.com/tree-sitter-grammars/tree-sitter-kdl) | core | `HFIJL` | @amaanq
@ -177,6 +183,7 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[ninja](https://github.com/alemuller/tree-sitter-ninja) | community | `HFIJ ` | @alemuller
[nix](https://github.com/cstrahan/tree-sitter-nix) | community | `HFIJL` | @leo60228
[nqc](https://github.com/tree-sitter-grammars/tree-sitter-nqc) | core | `HFIJL` | @amaanq
[nu](https://github.com/nushell/tree-sitter-nu) | community | `H IJ ` | @abhisheksingh0x558
[objc](https://github.com/tree-sitter-grammars/tree-sitter-objc) | core | `HFIJL` | @amaanq
[objdump](https://github.com/ColinKennedy/tree-sitter-objdump) | community | `H  J ` | @ColinKennedy
[ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) | core | `HFIJL` | @undu
@ -233,6 +240,7 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[ron](https://github.com/tree-sitter-grammars/tree-sitter-ron) | core | `HFIJL` | @amaanq
[rst](https://github.com/stsewd/tree-sitter-rst) | community | `H  JL` | @stsewd
[ruby](https://github.com/tree-sitter/tree-sitter-ruby) | core | `HFIJL` | @TravonteD
[runescript](https://github.com/2004Scape/tree-sitter-runescript) | community | `H  J ` | @2004Scape
[rust](https://github.com/tree-sitter/tree-sitter-rust) | core | `HFIJL` | @amaanq
[scala](https://github.com/tree-sitter/tree-sitter-scala) | core | `HF JL` | @stevanmilic
[scfg](https://github.com/rockorager/tree-sitter-scfg) | unsupported | `H  J ` | @WhyNotHugo
@ -240,6 +248,7 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[scss](https://github.com/serenadeai/tree-sitter-scss) | community | `HFIJ ` | @elianiva
[sflog](https://github.com/aheber/tree-sitter-sfapex)[^sflog] | community | `H    ` | @aheber, @xixiaofinland
[slang](https://github.com/tree-sitter-grammars/tree-sitter-slang)[^slang] | core | `HFIJL` | @theHamsta
[slim](https://github.com/theoo/tree-sitter-slim) | community | `     ` | @theoo
[slint](https://github.com/slint-ui/tree-sitter-slint) | community | `HFIJL` | @hunger
[smali](https://github.com/tree-sitter-grammars/tree-sitter-smali) | core | `HFIJL` | @amaanq
[smithy](https://github.com/indoorvivants/tree-sitter-smithy) | community | `H  J ` | @amaanq, @keynmol
@ -259,10 +268,10 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[superhtml](https://github.com/kristoff-it/superhtml) | community | `H  J ` | @rockorager
[surface](https://github.com/connorlay/tree-sitter-surface) | community | `HFIJ ` | @connorlay
[svelte](https://github.com/tree-sitter-grammars/tree-sitter-svelte) | core | `HFIJL` | @amaanq
[sway](https://github.com/FuelLabs/tree-sitter-sway.git) | core | `HFIJL` | @ribru17
[swift](https://github.com/alex-pinkus/tree-sitter-swift) | community | `HFIJL` | @alex-pinkus
[sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) | community | `HF J ` | @RaafatTurki
[systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) | community | `HF JL` | @ok-ryoko
[systemverilog](https://github.com/zhangwwpeng/tree-sitter-systemverilog) | community | `HF J ` | @zhangwwpeng
[t32](https://gitlab.com/xasc/tree-sitter-t32) | community | `HFIJL` | @xasc
[tablegen](https://github.com/tree-sitter-grammars/tree-sitter-tablegen) | core | `HFIJL` | @amaanq
[tact](https://github.com/tact-lang/tree-sitter-tact) | community | `HFIJL` | @novusnota
@ -287,13 +296,13 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[typst](https://github.com/uben0/tree-sitter-typst) | community | `HFIJ ` | @uben0, @RaafatTurki
[udev](https://github.com/tree-sitter-grammars/tree-sitter-udev) | core | `H  JL` | @ObserverOfTime
[ungrammar](https://github.com/tree-sitter-grammars/tree-sitter-ungrammar) | core | `HFIJL` | @Philipp-M, @amaanq
[unison](https://github.com/kylegoetz/tree-sitter-unison) | community | `H  J ` | @tapegram
[unison](https://github.com/kylegoetz/tree-sitter-unison) | community | `HF J ` | @tapegram
[usd](https://github.com/ColinKennedy/tree-sitter-usd) | community | `HFIJL` | @ColinKennedy
[uxntal](https://github.com/tree-sitter-grammars/tree-sitter-uxntal) | core | `HFIJL` | @amaanq
[v](https://github.com/vlang/v-analyzer) | community | `HFIJL` | @kkharji, @amaanq
[vala](https://github.com/vala-lang/tree-sitter-vala) | community | `HF J ` | @Prince781
[vento](https://github.com/ventojs/tree-sitter-vento) | community | `H  J ` | @wrapperup, @oscarotero
[verilog](https://github.com/tree-sitter/tree-sitter-verilog) | core | `HF JL` | @zegervdv
[verilog](https://github.com/gmlarumbe/tree-sitter-systemverilog) | community | `HF J ` | @zhangwwpeng
[vhdl](https://github.com/jpt13653903/tree-sitter-vhdl) | community | `HF J ` | @jpt13653903
[vhs](https://github.com/charmbracelet/tree-sitter-vhs) | community | `H  J ` | @caarlos0
[vim](https://github.com/tree-sitter-grammars/tree-sitter-vim) | stable | `HF JL` | @clason
@ -306,6 +315,7 @@ jsx (queries only)[^jsx] | community | `HFIJ ` | @steelsojka
[wit](https://github.com/liamwh/tree-sitter-wit) | community | `HF J ` | @liamwh
[xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | core | `H  JL` | @ObserverOfTime
[xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | core | `HFIJL` | @ObserverOfTime
[xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | community | `HF JL` | @ValdezFOmar
[yaml](https://github.com/tree-sitter-grammars/tree-sitter-yaml) | core | `HFIJL` | @amaanq
[yang](https://github.com/Hubro/tree-sitter-yang) | community | `HFIJ ` | @Hubro
[yuck](https://github.com/tree-sitter-grammars/tree-sitter-yuck) | core | `HFIJL` | @Philipp-M, @amaanq

View file

@ -406,8 +406,8 @@ end
--- Install a parser
---@param languages string[]
---@param options? InstallOptions
---@param _callback? fun()
local function install(languages, options, _callback)
---@param callback? fun(boolean)
local function install(languages, options, callback)
options = options or {}
local cache_dir = fs.normalize(fn.stdpath('cache'))
@ -430,9 +430,12 @@ local function install(languages, options, _callback)
a.main()
log.info('Installed %d/%d languages', done, #tasks)
end
if callback then
callback(done == #tasks)
end
end
M.install = a.sync(function(languages, options, _callback)
M.install = a.sync(function(languages, options, callback)
reload_parsers()
if not languages or #languages == 0 then
languages = 'all'
@ -444,8 +447,8 @@ M.install = a.sync(function(languages, options, _callback)
options.force = true
end
install(languages, options)
end, 2)
install(languages, options, callback)
end, 3)
---@class UpdateOptions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,3 @@
local uv = vim.uv
local M = {}
--- @param filename string

View file

@ -1,5 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((doc_block) @injection.content
(#set! injection.language "markdown"))

View file

@ -1,5 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((macro_text) @injection.content
(#set! injection.language "verilog"))

View file

@ -1,2 +1,5 @@
((comment) @injection.content
(#set! injection.language "comment"))
((doc_block) @injection.content
(#set! injection.language "markdown"))

View file

@ -1,2 +1,5 @@
((comment) @injection.content
(#set! injection.language "comment"))
((macro_text) @injection.content
(#set! injection.language "verilog"))

View file

@ -18,15 +18,18 @@ vim.opt.runtimepath:append('.')
-- needed on CI
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
local done = false
local ok = nil
require('nvim-treesitter.install').install(
#parsers > 0 and parsers or 'all',
{ force = true, generate = generate, max_jobs = max_jobs },
function()
done = true
function(success)
ok = success
end
)
vim.wait(6000000, function()
return done
return ok ~= nil
end)
if not ok then
vim.cmd.cq()
end