fix: install dependencies

This commit is contained in:
Christian Clason 2023-05-31 09:19:16 +02:00
parent 008cc677d2
commit ea192c36ad
8 changed files with 205 additions and 131 deletions

View file

@ -51,12 +51,13 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[doxygen](https://github.com/amaanq/tree-sitter-doxygen) | stable | `H IJ ` | | | @amaanq
[dtd](https://github.com/ObserverOfTime/tree-sitter-xml) | stable | `HF J ` | | | @ObserverOfTime
[ebnf](https://github.com/RubixDev/ebnf) | unstable | `H    ` | | | @RubixDev
ecma (queries only)[^ecma] | | `HFIJL` | | | @steelsojka
[eex](https://github.com/connorlay/tree-sitter-eex) | | `H  J ` | | | @connorlay
[elixir](https://github.com/elixir-lang/tree-sitter-elixir) | | `HFIJL` | | | @connorlay
[elm](https://github.com/elm-tooling/tree-sitter-elm) | | `H  J ` | | | @zweimach
[elsa](https://github.com/glapa-grossklag/tree-sitter-elsa) | | `HFIJL` | | | @glapa-grossklag, @amaanq
[elvish](https://github.com/elves/tree-sitter-elvish) | | `H  J ` | | | @elves
[embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template) | | `H  J ` | | |
[embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template) | unstable | `H  J ` | | |
[erlang](https://github.com/WhatsApp/tree-sitter-erlang) | | `HF   ` | | | @filmor
[fennel](https://github.com/travonted/tree-sitter-fennel) | | `HF JL` | | | @TravonteD
[firrtl](https://github.com/amaanq/tree-sitter-firrtl) | | `HFIJL` | | | @amaanq
@ -84,9 +85,9 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[gpg](https://github.com/ObserverOfTime/tree-sitter-gpg-config) | stable | `H  J ` | | | @ObserverOfTime
[graphql](https://github.com/bkegley/tree-sitter-graphql) | | `H IJ ` | | | @bkegley
[groovy](https://github.com/Decodetalkers/tree-sitter-groovy) | community | `H  J ` | | | @Decodetalkers
[hack](https://github.com/slackhq/tree-sitter-hack) | | `H    ` | | |
[hack](https://github.com/slackhq/tree-sitter-hack) | unstable | `H    ` | | |
[hare](https://github.com/amaanq/tree-sitter-hare) | | `HFIJL` | | | @amaanq
[haskell](https://github.com/tree-sitter/tree-sitter-haskell) | | `HF J ` | | |
[haskell](https://github.com/tree-sitter/tree-sitter-haskell) | unstable | `HF J ` | | |
[haskell_persistent](https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent) | | `HF   ` | | | @lykahb
[hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) | | `HFIJ ` | | | @MichaHoffmann
[heex](https://github.com/connorlay/tree-sitter-heex) | | `HFIJL` | | | @connorlay
@ -95,6 +96,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[hocon](https://github.com/antosha417/tree-sitter-hocon) | | `H  J ` | | ✓ | @antosha417
[hoon](https://github.com/urbit-pilled/tree-sitter-hoon) | unstable | `HF  L` | | | @urbit-pilled
[html](https://github.com/tree-sitter/tree-sitter-html) | | `HFIJL` | | | @TravonteD
html_tags (queries only)[^html_tags] | | `H IJ ` | | | @TravonteD
[htmldjango](https://github.com/interdependence/tree-sitter-htmldjango) | unstable | `HFIJ ` | | | @ObserverOfTime
[http](https://github.com/rest-nvim/tree-sitter-http) | | `H  J ` | | ✓ | @amaanq
[hurl](https://github.com/pfeiferj/tree-sitter-hurl) | community | `HFIJ ` | | | @pfeiferj
@ -107,8 +109,9 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) | | `H    ` | | | @steelsojka
[json](https://github.com/tree-sitter/tree-sitter-json) | | `HFI L` | | | @steelsojka
[json5](https://github.com/Joakker/tree-sitter-json5) | | `H  J ` | | | @Joakker
[jsonc](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git)[^jsonc] | | `HFIJL` | | ✓ | @WhyNotHugo
[jsonc](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git) | | `HFIJL` | | ✓ | @WhyNotHugo
[jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) | | `HF  L` | | | @nawordar
jsx (queries only)[^jsx] | | `HFIJ ` | | | @steelsojka
[julia](https://github.com/tree-sitter/tree-sitter-julia) | community | `HFIJL` | | | @theHamsta
[kconfig](https://github.com/amaanq/tree-sitter-kconfig) | stable | `HFIJL` | | | @amaanq
[kdl](https://github.com/amaanq/tree-sitter-kdl) | | `HFIJL` | | | @amaanq
@ -130,7 +133,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[mermaid](https://github.com/monaqa/tree-sitter-mermaid) | unstable | `H    ` | | |
[meson](https://github.com/Decodetalkers/tree-sitter-meson) | | `HF J ` | | | @Decodetalkers
[mlir](https://github.com/artagnon/tree-sitter-mlir) | unstable | `H   L` | ✓ | | @artagnon
[nickel](https://github.com/nickel-lang/tree-sitter-nickel) | | `H I  ` | | |
[nickel](https://github.com/nickel-lang/tree-sitter-nickel) | unstable | `H I  ` | | |
[ninja](https://github.com/alemuller/tree-sitter-ninja) | | `HFI  ` | | | @alemuller
[nix](https://github.com/cstrahan/tree-sitter-nix) | | `HF JL` | | | @leo60228
[norg](https://github.com/nvim-neorg/tree-sitter-norg) | unstable | `     ` | | | @JoeyGrajciar, @vhyrro
@ -140,7 +143,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[ocaml_interface](https://github.com/tree-sitter/tree-sitter-ocaml) | | `HFIJL` | | | @undu
[ocamllex](https://github.com/atom-ocaml/tree-sitter-ocamllex) | | `H  J ` | ✓ | | @undu
[odin](https://github.com/amaanq/tree-sitter-odin) | | `HFIJL` | | | @amaanq
[org](https://github.com/milisims/tree-sitter-org) | | `     ` | | |
[org](https://github.com/milisims/tree-sitter-org) | unstable | `     ` | | |
[pascal](https://github.com/Isopod/tree-sitter-pascal.git) | | `HFIJL` | | | @Isopod
[passwd](https://github.com/ath3/tree-sitter-passwd) | | `H    ` | | | @amaanq
[pem](https://github.com/ObserverOfTime/tree-sitter-pem) | stable | `HF J ` | | | @ObserverOfTime
@ -180,7 +183,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[scala](https://github.com/tree-sitter/tree-sitter-scala) | | `HF JL` | | | @stevanmilic
[scfg](https://git.sr.ht/~rockorager/tree-sitter-scfg) | community | `H  J ` | ✓ | | @WhyNotHugo
[scheme](https://github.com/6cdh/tree-sitter-scheme) | unstable | `HF J ` | | |
[scss](https://github.com/serenadeai/tree-sitter-scss) | | `HFI  ` | | | @elianiva
[scss](https://github.com/serenadeai/tree-sitter-scss) | community | `HFI  ` | | | @elianiva
[slint](https://github.com/jrmoulton/tree-sitter-slint) | unstable | `H I  ` | | | @jrmoulton
[smali](https://git.sr.ht/~yotam/tree-sitter-smali) | | `HFIJL` | | | @amaanq
[smithy](https://github.com/indoorvivants/tree-sitter-smithy) | | `H    ` | | | @amaanq, @keynmol
@ -199,7 +202,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[t32](https://gitlab.com/xasc/tree-sitter-t32.git) | community | `HFIJL` | | | @xasc
[tablegen](https://github.com/amaanq/tree-sitter-tablegen) | | `HFIJL` | | | @amaanq
[teal](https://github.com/euclidianAce/tree-sitter-teal) | | `HFIJL` | ✓ | | @euclidianAce
[terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) | | `HFIJ ` | | | @MichaHoffmann
[terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) | community | `HFIJ ` | | | @MichaHoffmann
[thrift](https://github.com/duskmoon314/tree-sitter-thrift) | | `HFIJL` | | | @amaanq, @duskmoon314
[tiger](https://github.com/ambroisie/tree-sitter-tiger) | | `HFIJL` | | | @ambroisie
[tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) | | `HF JL` | | | @ahelwer, @susliko
@ -229,11 +232,13 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[yang](https://github.com/Hubro/tree-sitter-yang) | | `HFIJ ` | | | @Hubro
[yuck](https://github.com/Philipp-M/tree-sitter-yuck) | | `HFIJL` | | | @Philipp-M, @amaanq
[zig](https://github.com/maxxnino/tree-sitter-zig) | | `HFIJL` | | | @maxxnino
[^ecma]: queries required by javascript, typescript, tsx, qmljs
[^gdscript]: Godot
[^git_config]: git_config
[^glimmer]: Glimmer and Ember
[^godot_resource]: Godot Resources
[^jsonc]: JSON with comments
[^html_tags]: queries required by html, astro, vue, svelte
[^jsx]: queries required by javascript, tsx
[^luap]: Lua patterns
[^markdown]: basic highlighting
[^markdown_inline]: needed for full highlighting

View file

@ -5,14 +5,9 @@ This document lists the planned and finished changes in this rewrite towards [Nv
## TODO
- [ ] **`query_predicates.lua`:** upstream/remove
- [ ] **`parsers.lua`:** add dependencies (and "query-only" langs like ecma, jsx, html_tags, ...)
- [ ] **`parsers.lua`:** assign tiers
- [ ] **`parsers.lua`:** modularize?
- [ ] **`install.lua`:** simplify compilation:
- hardcode one compiler + args per platform
- provide `install.compile_command` for overriding (function that takes files, ...?)
- allow using repo makefile (norg!)?
- ...or switch to makefile completely?
- [ ] **`install.lua`:** drop norg (and makefile); document c++11 requirement
- [ ] **`locals.lua`:** move to `nvim-treesitter-refactor`?
- [ ] **update-lockfile:** allow specifying version in addition to commit hash (for Tier 1)
- [ ] **update-lockfile:** one commit per parser/tier?

View file

@ -74,12 +74,11 @@ end
---@return string[]
function M.installed_parsers()
local install_dir = M.get_install_dir('parser')
local install_dir = M.get_install_dir('queries')
local installed = {} --- @type string[]
for f in vim.fs.dir(install_dir) do
local lang = assert(f:match('(.*)%..*'))
installed[#installed + 1] = lang
installed[#installed + 1] = f
end
return installed
@ -139,6 +138,14 @@ function M.norm_languages(languages, skip)
end, languages) --[[@as string[] ]]
end
if not (skip and skip.dependencies) then
for _, lang in pairs(languages) do
if parsers.configs[lang].requires then
vim.list_extend(languages, parsers.configs[lang].requires)
end
end
end
return languages
end

View file

@ -1,4 +1,5 @@
local install = require('nvim-treesitter.install')
local parsers = require('nvim-treesitter.parsers')
local config = require('nvim-treesitter.config')
local util = require('nvim-treesitter.util')
local tsq = vim.treesitter.query
@ -123,14 +124,25 @@ function M.check()
-- Installation dependency checks
install_health()
-- Parser installation checks
local languages = config.installed_parsers()
local parser_installation = { 'Parser/Features' .. string.rep(' ', 9) .. 'H L F I J' }
for _, parser_name in pairs(config.installed_parsers()) do
local out = ' - ' .. parser_name .. string.rep(' ', 20 - #parser_name)
for _, query_group in pairs(M.bundled_queries) do
local status, err = query_status(parser_name, query_group)
out = out .. status .. ' '
if err then
table.insert(error_collection, { parser_name, query_group, err })
for _, lang in pairs(languages) do
local parser = parsers.configs[lang]
local out = ' - ' .. lang .. string.rep(' ', 20 - #lang)
if parser.install_info then
for _, query_group in pairs(M.bundled_queries) do
local status, err = query_status(lang, query_group)
out = out .. status .. ' '
if err then
table.insert(error_collection, { lang, query_group, err })
end
end
end
if parser.requires then
for _, p in pairs(parser.requires) do
if not vim.list_contains(languages, p) then
table.insert(error_collection, { lang, 'queries', 'dependency ' .. p .. ' missing' })
end
end
end
table.insert(parser_installation, vim.fn.trim(out, ' ', 2))

View file

@ -446,74 +446,76 @@ local function install_lang(lang, cache_dir, install_dir, force, generate_from_g
end
end
local cc = M.select_executable(M.compilers)
if not cc then
cc_err()
return
end
local logger = log.new('install/' .. lang)
local err
local repo = get_parser_install_info(lang)
local project_name = 'tree-sitter-' .. lang
local logger = log.new('install/' .. lang)
generate_from_grammar = repo.requires_generate_from_grammar or generate_from_grammar
if generate_from_grammar and vim.fn.executable('tree-sitter') ~= 1 then
logger:error('tree-sitter CLI not found: `tree-sitter` is not executable')
end
if generate_from_grammar and vim.fn.executable('node') ~= 1 then
logger:error('Node JS not found: `node` is not executable')
end
local revision = repo.revision or get_target_revision(lang)
local maybe_local_path = fs.normalize(repo.url)
local from_local_path = vim.fn.isdirectory(maybe_local_path) == 1
if from_local_path then
repo.url = maybe_local_path
end
if not from_local_path then
util.delete(fs.joinpath(cache_dir, project_name))
local project_dir = fs.joinpath(cache_dir, project_name)
revision = revision or repo.branch or 'master'
if can_download_tar(repo) then
do_download_tar(logger, repo, project_name, cache_dir, revision, project_dir)
else
do_download_git(logger, repo, project_name, cache_dir, revision, project_dir)
if repo then
local cc = M.select_executable(M.compilers)
if not cc then
cc_err()
return
end
end
local compile_location = get_compile_location(repo, cache_dir, project_name, from_local_path)
local project_name = 'tree-sitter-' .. lang
if generate_from_grammar then
do_generate_from_grammar(logger, repo, compile_location)
end
generate_from_grammar = repo.requires_generate_from_grammar or generate_from_grammar
logger:info('Compiling parser')
local r = do_compile(repo, cc, compile_location)
if r.exit_code > 0 then
logger:error('Error during compilation: ' .. vim.inspect(r.stderr))
end
if generate_from_grammar and vim.fn.executable('tree-sitter') ~= 1 then
logger:error('tree-sitter CLI not found: `tree-sitter` is not executable')
end
local parser_lib_name = fs.joinpath(install_dir, lang) .. '.so'
if generate_from_grammar and vim.fn.executable('node') ~= 1 then
logger:error('Node JS not found: `node` is not executable')
end
local err = uv_copyfile(fs.joinpath(compile_location, 'parser.so'), parser_lib_name)
a.main()
if err then
logger:error(err)
end
local revision = repo.revision or get_target_revision(lang)
local revfile = fs.joinpath(config.get_install_dir('parser-info') or '', lang .. '.revision')
util.write_file(revfile, revision or '')
local maybe_local_path = fs.normalize(repo.url)
local from_local_path = vim.fn.isdirectory(maybe_local_path) == 1
if from_local_path then
repo.url = maybe_local_path
end
if not from_local_path then
util.delete(fs.joinpath(cache_dir, project_name))
if not from_local_path then
util.delete(fs.joinpath(cache_dir, project_name))
local project_dir = fs.joinpath(cache_dir, project_name)
revision = revision or repo.branch or 'master'
if can_download_tar(repo) then
do_download_tar(logger, repo, project_name, cache_dir, revision, project_dir)
else
do_download_git(logger, repo, project_name, cache_dir, revision, project_dir)
end
end
local compile_location = get_compile_location(repo, cache_dir, project_name, from_local_path)
if generate_from_grammar then
do_generate_from_grammar(logger, repo, compile_location)
end
logger:info('Compiling parser')
local r = do_compile(repo, cc, compile_location)
if r.exit_code > 0 then
logger:error('Error during compilation: ' .. vim.inspect(r.stderr))
end
local parser_lib_name = fs.joinpath(install_dir, lang) .. '.so'
err = uv_copyfile(fs.joinpath(compile_location, 'parser.so'), parser_lib_name)
a.main()
if err then
logger:error(err)
end
local revfile = fs.joinpath(config.get_install_dir('parser-info') or '', lang .. '.revision')
util.write_file(revfile, revision or '')
if not from_local_path then
util.delete(fs.joinpath(cache_dir, project_name))
end
end
local queries = fs.joinpath(config.get_install_dir('queries'), lang)
@ -524,7 +526,7 @@ local function install_lang(lang, cache_dir, install_dir, force, generate_from_g
if err then
logger:error(err)
end
logger:info('Parser installed')
logger:info('Language installed')
end
--- Throttles a function using the first argument as an ID
@ -614,7 +616,7 @@ local function install(languages, options, _callback)
a.join(max_jobs, nil, tasks)
if #tasks > 1 then
a.main()
log.info('Installed %d/%d parsers', done, #tasks)
log.info('Installed %d/%d languages', done, #tasks)
end
end
@ -647,34 +649,35 @@ end, 2)
local function uninstall_lang(lang, parser, queries)
local logger = log.new('uninstall/' .. lang)
logger:debug('Uninstalling ' .. lang)
if vim.fn.filereadable(parser) ~= 1 then
return
if vim.fn.filereadable(parser) == 1 then
logger:debug('Unlinking ' .. parser)
local perr = uv_unlink(parser)
a.main()
if perr then
log.error(perr)
end
end
logger:debug('Unlinking ' .. parser)
local perr = uv_unlink(parser)
a.main()
if vim.fn.isdirectory(queries) == 1 then
logger:debug('Unlinking ' .. queries)
local qerr = uv_unlink(queries)
a.main()
if perr then
log.error(perr)
if qerr then
logger:error(qerr)
end
end
logger:debug('Unlinking ' .. queries)
local qerr = uv_unlink(queries)
a.main()
if qerr then
logger:error(qerr)
end
logger:info('Parser uninstalled')
logger:info('Language uninstalled')
end
--- @param languages string[]|string
--- @param _options? UpdateOptions
--- @param _callback fun()
M.uninstall = a.sync(function(languages, _options, _callback)
languages = config.norm_languages(languages or 'all', { missing = true })
languages = config.norm_languages(languages or 'all', { missing = true, dependencies = true })
local parser_dir = config.get_install_dir('parser')
local query_dir = config.get_install_dir('queries')
@ -698,7 +701,7 @@ M.uninstall = a.sync(function(languages, _options, _callback)
a.join(max_jobs, nil, tasks)
if #tasks > 1 then
a.main()
log.info('Uninstalled %d/%d parsers', done, #tasks)
log.info('Uninstalled %d/%d languages', done, #tasks)
end
end, 2)

View file

@ -12,6 +12,7 @@
---@field install_info InstallInfo
---@field filetype string[]
---@field maintainers string[]
---@field requires string[]
---@field tier integer|nil
---@field readme_note string|nil
@ -43,6 +44,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@ObserverOfTime' },
requires = { 'cpp' },
},
astro = {
@ -51,6 +53,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.cc' },
},
maintainers = { '@virchau13' },
requires = { 'html', 'html_tags' },
},
awk = {
@ -225,6 +228,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'c' },
},
css = {
@ -242,6 +246,7 @@ M.configs = {
location = 'csv',
},
maintainers = { '@amaanq' },
requires = { 'tsv' },
tier = 2,
},
@ -252,6 +257,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'cpp' },
},
cue = {
@ -349,6 +355,11 @@ M.configs = {
tier = 4,
},
ecma = {
maintainers = { '@steelsojka' },
readme_note = 'queries required by javascript, typescript, tsx, qmljs',
},
eex = {
install_info = {
url = 'https://github.com/connorlay/tree-sitter-eex',
@ -394,6 +405,7 @@ M.configs = {
url = 'https://github.com/tree-sitter/tree-sitter-embedded-template',
files = { 'src/parser.c' },
},
tier = 4,
},
erlang = {
@ -552,6 +564,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'c' },
},
go = {
@ -626,6 +639,7 @@ M.configs = {
url = 'https://github.com/slackhq/tree-sitter-hack',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 4,
},
hare = {
@ -641,6 +655,7 @@ M.configs = {
url = 'https://github.com/tree-sitter/tree-sitter-haskell',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 4,
},
haskell_persistent = {
@ -675,6 +690,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@winston0410' },
requires = { 'json' },
},
hlsl = {
@ -684,6 +700,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'cpp' },
},
hocon = {
@ -704,12 +721,18 @@ M.configs = {
tier = 4,
},
html_tags = {
maintainers = { '@TravonteD' },
readme_note = 'queries required by html, astro, vue, svelte',
},
html = {
install_info = {
url = 'https://github.com/tree-sitter/tree-sitter-html',
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@TravonteD' },
requires = { 'html_tags' },
},
htmldjango = {
@ -755,6 +778,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@fab4100' },
requires = { 'c' },
},
janet_simple = {
@ -779,6 +803,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@steelsojka' },
requires = { 'ecma', 'jsx' },
},
jq = {
@ -820,7 +845,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@WhyNotHugo' },
readme_note = 'JSON with comments',
requires = { 'json' },
},
jsonnet = {
@ -831,6 +856,11 @@ M.configs = {
maintainers = { '@nawordar' },
},
jsx = {
maintainers = { '@steelsojka' },
readme_note = 'queries required by javascript, tsx',
},
julia = {
install_info = {
url = 'https://github.com/tree-sitter/tree-sitter-julia',
@ -903,8 +933,8 @@ M.configs = {
url = 'https://github.com/MunifTanjim/tree-sitter-lua',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 1,
maintainers = { '@muniftanjim' },
tier = 1,
},
luadoc = {
@ -930,6 +960,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@amaanq' },
requires = { 'lua' },
},
m68k = {
@ -956,6 +987,7 @@ M.configs = {
},
maintainers = { '@MDeiml' },
readme_note = 'basic highlighting',
requires = { 'markdown_inline' },
tier = 1,
},
@ -1008,8 +1040,8 @@ M.configs = {
files = { 'src/parser.c' },
requires_generate_from_grammar = true,
},
tier = 4,
maintainers = { '@artagnon' },
tier = 4,
},
nickel = {
@ -1017,6 +1049,7 @@ M.configs = {
url = 'https://github.com/nickel-lang/tree-sitter-nickel',
files = { 'src/parser.c', 'src/scanner.cc' },
},
tier = 4,
},
ninja = {
@ -1041,8 +1074,8 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.cc' },
use_makefile = true,
},
tier = 4,
maintainers = { '@JoeyGrajciar', '@vhyrro' },
tier = 4,
},
nqc = {
@ -1060,6 +1093,7 @@ M.configs = {
files = { 'src/parser.c' },
},
maintainers = { '@amaanq' },
requires = { 'c' },
},
ocaml = {
@ -1078,6 +1112,7 @@ M.configs = {
location = 'interface',
},
maintainers = { '@undu' },
requires = { 'ocaml' },
},
ocamllex = {
@ -1102,6 +1137,7 @@ M.configs = {
url = 'https://github.com/milisims/tree-sitter-org',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 4,
},
pascal = {
@ -1229,6 +1265,7 @@ M.configs = {
location = 'psv',
},
maintainers = { '@amaanq' },
requires = { 'tsv' },
tier = 2,
},
@ -1289,6 +1326,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@Decodetalkers' },
requires = { 'ecma' },
},
query = {
@ -1441,6 +1479,8 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@elianiva' },
requires = { 'css' },
tier = 3,
},
slint = {
@ -1540,6 +1580,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@elianiva' },
requires = { 'html_tags' },
},
swift = {
@ -1601,6 +1642,8 @@ M.configs = {
location = 'dialects/terraform',
},
maintainers = { '@MichaHoffmann' },
requires = { 'hcl' },
tier = 3,
},
thrift = {
@ -1663,6 +1706,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@steelsojka' },
requires = { 'ecma', 'jsx', 'typescript' },
},
turtle = {
@ -1689,6 +1733,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@steelsojka' },
requires = { 'ecma' },
},
ungrammar = {
@ -1783,6 +1828,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.cc' },
},
maintainers = { '@WhyNotHugo' },
requires = { 'html_tags' },
},
wing = {
@ -1820,6 +1866,7 @@ M.configs = {
location = 'tree-sitter-xml',
},
maintainers = { '@ObserverOfTime' },
requires = { 'dtd' },
tier = 2,
},

View file

@ -21,21 +21,12 @@ end)
-- check for new revisions
for _, v in ipairs(sorted_parsers) do
if skip_langs and not vim.list_contains(skip_langs, v.name) then
local sha ---@type string
if not vim.list_contains(skip_langs, v.name) and v.parser.install_info then
local cmd = 'git ls-remote ' .. v.parser.install_info.url
if v.parser.install_info.branch then
sha = vim.split(
vim.fn.systemlist(
'git ls-remote '
.. v.parser.install_info.url
.. ' | grep refs/heads/'
.. v.parser.install_info.branch
)[1],
'\t'
)[1]
else
sha = vim.split(vim.fn.systemlist('git ls-remote ' .. v.parser.install_info.url)[1], '\t')[1]
cmd = cmd .. ' | grep refs/heads/' .. v.parser.install_info.branch
end
local sha = vim.split(vim.fn.systemlist(cmd)[1], '\t')[1]
lockfile[v.name] = { revision = sha }
print(v.name .. ': ' .. sha)
else
@ -43,5 +34,8 @@ for _, v in ipairs(sorted_parsers) do
end
end
lockfile = vim.fn.system('jq --sort-keys', vim.json.encode(lockfile))
lockfile = vim.json.encode(lockfile)
if vim.fn.executable('jq') == 1 then
lockfile = vim.fn.system('jq --sort-keys', lockfile)
end
util.write_file(filename, lockfile)

View file

@ -23,14 +23,23 @@ local footnotes = ''
for _, v in ipairs(sorted_parsers) do
local p = v.parser
-- language
generated_text = generated_text
.. '['
.. v.name
.. ']('
.. p.install_info.url
.. ')'
.. (p.readme_note and '[^' .. v.name .. ']' or '')
.. ' | '
if p.install_info then
generated_text = generated_text
.. '['
.. v.name
.. ']('
.. p.install_info.url
.. ')'
.. (p.readme_note and '[^' .. v.name .. ']' or '')
.. ' | '
else
generated_text = generated_text
.. v.name
.. ' (queries only)'
.. (p.readme_note and '[^' .. v.name .. ']' or '')
.. ' | '
end
if p.readme_note then
footnotes = footnotes .. '[^' .. v.name .. ']: ' .. p.readme_note .. '\n'
end
@ -50,11 +59,13 @@ for _, v in ipairs(sorted_parsers) do
-- CLI
generated_text = generated_text
.. (p.install_info.requires_generate_from_grammar and '' or '')
.. (p.install_info and p.install_info.requires_generate_from_grammar and '' or '')
.. ' | '
-- NPM
generated_text = generated_text .. (p.install_info.generate_requires_npm and '' or '') .. ' | '
generated_text = generated_text
.. (p.install_info and p.install_info.generate_requires_npm and '' or '')
.. ' | '
-- Maintainer
generated_text = generated_text