fix: install dependencies

This commit is contained in:
Christian Clason
2023-05-31 09:19:16 +02:00
parent 9c0a99819c
commit cd2c826972
8 changed files with 207 additions and 131 deletions

View File

@@ -58,13 +58,14 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[dtd](https://github.com/tree-sitter-grammars/tree-sitter-xml) | stable | `HF JL` | | | @ObserverOfTime
[earthfile](https://github.com/glehmann/tree-sitter-earthfile) | community | `H  J ` | | | @glehmann
[ebnf](https://github.com/RubixDev/ebnf) | unstable | `H    ` | | | @RubixDev
ecma (queries only)[^ecma] | | `HFIJL` | | | @steelsojka
[eds](https://github.com/uyha/tree-sitter-eds) | community | `HF   ` | | | @uyha
[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
[facility](https://github.com/FacilityApi/tree-sitter-facility) | community | `HFIJ ` | | | @bryankenote
[faust](https://github.com/khiner/tree-sitter-faust) | community | `H  J ` | | | @khiner
@@ -100,9 +101,9 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[graphql](https://github.com/bkegley/tree-sitter-graphql) | | `H IJ ` | | | @bkegley
[groovy](https://github.com/murtaza64/tree-sitter-groovy) | community | `HFIJL` | | | @murtaza64
[gstlaunch](https://github.com/theHamsta/tree-sitter-gstlaunch) | stable | `H    ` | | | @theHamsta
[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 ` | | | @mrcjkb
[haskell](https://github.com/tree-sitter/tree-sitter-haskell) | community | `HF J ` | | | @mrcjkb
[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
@@ -113,6 +114,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[hocon](https://github.com/antosha417/tree-sitter-hocon) | | `HF 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, @NTBBloodbath
[hurl](https://github.com/pfeiferj/tree-sitter-hurl) | community | `HFIJ ` | | | @pfeiferj
@@ -128,8 +130,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
[just](https://github.com/IndianBoy42/tree-sitter-just) | community | `HFIJL` | | | @Hubro
[kconfig](https://github.com/amaanq/tree-sitter-kconfig) | stable | `HFIJL` | | | @amaanq
@@ -160,7 +163,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[mlir](https://github.com/artagnon/tree-sitter-mlir) | unstable | `H   L` | ✓ | | @artagnon
[muttrc](https://github.com/neomutt/tree-sitter-muttrc) | community | `H  J ` | | | @Freed-Wu
[nasm](https://github.com/naclsn/tree-sitter-nasm) | stable | `H  J ` | | | @ObserverOfTime
[nickel](https://github.com/nickel-lang/tree-sitter-nickel) | | `H I  ` | | |
[nickel](https://github.com/nickel-lang/tree-sitter-nickel) | unstable | `H I  ` | | |
[nim](https://github.com/alaviss/tree-sitter-nim) | community | `HF JL` | | | @aMOPel
[nim_format_string](https://github.com/aMOPel/tree-sitter-nim-format-string) | community | `H  J ` | | | @aMOPel
[ninja](https://github.com/alemuller/tree-sitter-ninja) | | `HFI  ` | | | @alemuller
@@ -173,7 +176,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
@@ -221,7 +224,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
[slang](https://github.com/theHamsta/tree-sitter-slang)[^slang] | unstable | `HFIJL` | | ✓ | @theHamsta
[slint](https://github.com/slint-ui/tree-sitter-slint) | community | `HFIJL` | | | @hunger
[smali](https://github.com/tree-sitter-grammars/tree-sitter-smali) | community | `HFIJL` | | | @amaanq
@@ -249,7 +252,7 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[tcl](https://github.com/tree-sitter-grammars/tree-sitter-tcl) | stable | `HFI  ` | | | @lewis6991
[teal](https://github.com/euclidianAce/tree-sitter-teal) | | `HFIJL` | ✓ | | @euclidianAce
[templ](https://github.com/vrischmann/tree-sitter-templ) | community | `H  J ` | | | @vrischmann
[terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) | | `HFIJ ` | | | @MichaHoffmann
[terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) | community | `HFIJ ` | | | @MichaHoffmann
[textproto](https://github.com/PorterAtGoogle/tree-sitter-textproto) | community | `HFI  ` | | | @Porter
[thrift](https://github.com/duskmoon314/tree-sitter-thrift) | | `HFIJL` | | | @amaanq, @duskmoon314
[tiger](https://github.com/ambroisie/tree-sitter-tiger) | | `HFIJL` | | | @ambroisie
@@ -288,11 +291,13 @@ Language | Tier | Queries | CLI | NPM | Maintainer
[yuck](https://github.com/Philipp-M/tree-sitter-yuck) | | `HFIJL` | | | @Philipp-M, @amaanq
[zathurarc](https://github.com/Freed-Wu/tree-sitter-zathurarc) | community | `H  J ` | | | @Freed-Wu
[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

@@ -449,74 +449,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)
@@ -527,7 +529,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
@@ -617,7 +619,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
@@ -650,34 +652,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')
@@ -701,7 +704,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
@@ -44,6 +45,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@dlvandenberg' },
requires = { 'html', 'html_tags' },
tier = 4,
},
@@ -63,6 +65,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@ObserverOfTime' },
requires = { 'cpp' },
},
asm = {
@@ -80,6 +83,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@virchau13' },
requires = { 'html', 'html_tags' },
},
authzed = {
@@ -309,6 +313,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'c' },
},
css = {
@@ -326,6 +331,7 @@ M.configs = {
location = 'csv',
},
maintainers = { '@amaanq' },
requires = { 'tsv' },
tier = 2,
},
@@ -336,6 +342,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'cpp' },
},
cue = {
@@ -476,6 +483,12 @@ M.configs = {
tier = 4,
},
ecma = {
maintainers = { '@steelsojka' },
readme_note = 'queries required by javascript, typescript, tsx, qmljs',
tier = 3,
},
editorconfig = {
install_info = {
url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig',
@@ -539,6 +552,7 @@ M.configs = {
url = 'https://github.com/tree-sitter/tree-sitter-embedded-template',
files = { 'src/parser.c' },
},
tier = 4,
},
enforce = {
@@ -796,6 +810,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'c' },
},
gn = {
@@ -925,6 +940,7 @@ M.configs = {
url = 'https://github.com/slackhq/tree-sitter-hack',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 4,
},
hare = {
@@ -941,6 +957,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@mrcjkb' },
tier = 3,
},
haskell_persistent = {
@@ -985,6 +1002,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@winston0410' },
requires = { 'json' },
},
hlsl = {
@@ -994,6 +1012,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@theHamsta' },
requires = { 'cpp' },
},
hlsplaylist = {
@@ -1023,12 +1042,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 = {
@@ -1118,6 +1143,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@fab4100' },
requires = { 'c' },
},
janet_simple = {
@@ -1151,6 +1177,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@steelsojka' },
requires = { 'ecma', 'jsx' },
},
jinja = {
@@ -1214,7 +1241,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@WhyNotHugo' },
readme_note = 'JSON with comments',
requires = { 'json' },
},
jsonnet = {
@@ -1225,6 +1252,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',
@@ -1370,8 +1402,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 = {
@@ -1397,6 +1429,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@amaanq' },
requires = { 'lua' },
},
m68k = {
@@ -1423,6 +1456,7 @@ M.configs = {
},
maintainers = { '@MDeiml' },
readme_note = 'basic highlighting',
requires = { 'markdown_inline' },
tier = 1,
},
@@ -1475,8 +1509,8 @@ M.configs = {
files = { 'src/parser.c' },
requires_generate_from_grammar = true,
},
tier = 4,
maintainers = { '@artagnon' },
tier = 4,
},
muttrc = {
@@ -1511,6 +1545,7 @@ M.configs = {
url = 'https://github.com/nickel-lang/tree-sitter-nickel',
files = { 'src/parser.c', 'src/scanner.c' },
},
tier = 4,
},
nim = {
@@ -1519,6 +1554,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@aMOPel' },
requires = { 'nim_format_string' },
tier = 3,
},
@@ -1553,8 +1589,8 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.cc' },
use_makefile = true,
},
tier = 4,
maintainers = { '@JoeyGrajciar', '@vhyrro' },
tier = 4,
},
nqc = {
@@ -1581,6 +1617,7 @@ M.configs = {
files = { 'src/parser.c' },
},
maintainers = { '@amaanq' },
requires = { 'c' },
},
objdump = {
@@ -1608,6 +1645,7 @@ M.configs = {
location = 'grammars/interface',
},
maintainers = { '@undu' },
requires = { 'ocaml' },
},
ocamllex = {
@@ -1826,6 +1864,7 @@ M.configs = {
location = 'psv',
},
maintainers = { '@amaanq' },
requires = { 'tsv' },
tier = 2,
},
@@ -1895,6 +1934,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@Decodetalkers' },
requires = { 'ecma' },
},
query = {
@@ -2120,6 +2160,8 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@elianiva' },
requires = { 'css' },
tier = 3,
},
sflog = {
@@ -2314,6 +2356,7 @@ M.configs = {
files = { 'src/parser.c', 'src/scanner.c' },
},
maintainers = { '@amaanq' },
requires = { 'html_tags' },
tier = 2,
},
@@ -2421,6 +2464,8 @@ M.configs = {
location = 'dialects/terraform',
},
maintainers = { '@MichaHoffmann' },
requires = { 'hcl' },
tier = 3,
},
textproto = {
@@ -2501,6 +2546,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@steelsojka' },
requires = { 'ecma', 'jsx', 'typescript' },
},
turtle = {
@@ -2527,6 +2573,7 @@ M.configs = {
generate_requires_npm = true,
},
maintainers = { '@steelsojka' },
requires = { 'ecma' },
},
typespec = {
@@ -2684,6 +2731,7 @@ M.configs = {
branch = 'main',
},
maintainers = { '@WhyNotHugo', '@lucario387' },
requires = { 'html_tags' },
tier = 2,
},
@@ -2737,6 +2785,7 @@ M.configs = {
location = '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