mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -04:00
feat: add "experimental" key to parsers
feat(ci): mark parsers as experimental in README
This commit is contained in:
parent
6b82b26a74
commit
e87ed0fdaa
4 changed files with 56 additions and 1 deletions
|
|
@ -140,6 +140,10 @@ For `nvim-treesitter` to support a specific feature for a specific language requ
|
||||||
|
|
||||||
The following is a list of languages for which a parser can be installed through `:TSInstall`; a checked box means that `nvim-treesitter` also contains queries at least for the `highlight` module.
|
The following is a list of languages for which a parser can be installed through `:TSInstall`; a checked box means that `nvim-treesitter` also contains queries at least for the `highlight` module.
|
||||||
|
|
||||||
|
Experimental parsers are parsers that are maintained, but not stable enough for
|
||||||
|
daily use yet. They are excluded from automatic installation when
|
||||||
|
`ensure_installed` is set to `"maintained"`.
|
||||||
|
|
||||||
We are looking for maintainers to add more parsers and to write query files for their languages.
|
We are looking for maintainers to add more parsers and to write query files for their languages.
|
||||||
|
|
||||||
<!--This section of the README is automatically updated by a CI job-->
|
<!--This section of the README is automatically updated by a CI job-->
|
||||||
|
|
|
||||||
|
|
@ -546,6 +546,8 @@ list.verilog = {
|
||||||
},
|
},
|
||||||
used_by = { "systemverilog" },
|
used_by = { "systemverilog" },
|
||||||
maintainers = { "@zegervdv" },
|
maintainers = { "@zegervdv" },
|
||||||
|
-- The parser still uses API version 12, because it does not compile with 13
|
||||||
|
experimental = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Parsers for injections
|
-- Parsers for injections
|
||||||
|
|
@ -772,6 +774,7 @@ function M.maintained_parsers()
|
||||||
local has_tree_sitter_cli = vim.fn.executable "tree-sitter" == 1 and vim.fn.executable "node" == 1
|
local has_tree_sitter_cli = vim.fn.executable "tree-sitter" == 1 and vim.fn.executable "node" == 1
|
||||||
return vim.tbl_filter(function(lang)
|
return vim.tbl_filter(function(lang)
|
||||||
return M.list[lang].maintainers
|
return M.list[lang].maintainers
|
||||||
|
and not M.list[lang].experimental
|
||||||
and (has_tree_sitter_cli or not M.list[lang].install_info.requires_generate_from_grammar)
|
and (has_tree_sitter_cli or not M.list[lang].install_info.requires_generate_from_grammar)
|
||||||
end, M.available_parsers())
|
end, M.available_parsers())
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ for _, v in ipairs(sorted_parsers) do
|
||||||
generated_text = generated_text
|
generated_text = generated_text
|
||||||
.. "- [x] "
|
.. "- [x] "
|
||||||
.. link
|
.. link
|
||||||
.. " (maintained by "
|
.. " ("
|
||||||
|
.. (v.parser.experimental and "experimental, " or "")
|
||||||
|
.. "maintained by "
|
||||||
.. table.concat(v.parser.maintainers, ", ")
|
.. table.concat(v.parser.maintainers, ", ")
|
||||||
.. ")\n"
|
.. ")\n"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
46
tests/unit/parsers_spec.lua
Normal file
46
tests/unit/parsers_spec.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
local stub = require "luassert.stub"
|
||||||
|
local parsers = require "nvim-treesitter.parsers"
|
||||||
|
|
||||||
|
describe("maintained_parsers", function()
|
||||||
|
before_each(function()
|
||||||
|
stub(vim.fn, "executable")
|
||||||
|
end)
|
||||||
|
|
||||||
|
after_each(function()
|
||||||
|
vim.fn.executable:clear()
|
||||||
|
end)
|
||||||
|
|
||||||
|
it("does not return experimental parsers", function()
|
||||||
|
local old_list = parsers.list
|
||||||
|
parsers.list = {
|
||||||
|
c = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/tree-sitter/tree-sitter-c",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
},
|
||||||
|
maintainers = { "@vigoux" },
|
||||||
|
},
|
||||||
|
d = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/CyberShadow/tree-sitter-d",
|
||||||
|
files = { "src/parser.c", "src/scanner.cc" },
|
||||||
|
requires_generate_from_grammar = true,
|
||||||
|
},
|
||||||
|
maintainers = { "@nawordar" },
|
||||||
|
experimental = true,
|
||||||
|
},
|
||||||
|
haskell = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/tree-sitter/tree-sitter-haskell",
|
||||||
|
files = { "src/parser.c", "src/scanner.cc" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local expected = { "c" }
|
||||||
|
|
||||||
|
assert.same(parsers.maintained_parsers(), expected)
|
||||||
|
|
||||||
|
parsers.list = old_list
|
||||||
|
end)
|
||||||
|
end)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue