Fix #292: Add parser links to README.md

This commit is contained in:
Stephan Seitz 2020-08-15 18:12:37 +02:00 committed by Thomas Vigouroux
parent 5d97cc5e09
commit 7c9ffe9e19
4 changed files with 151 additions and 58 deletions

25
.github/workflows/update-readme.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Check README parser info
on: [push, pull_request]
jobs:
luacheck:
name: Check README parser info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Prepare
run: |
sudo apt-get update
sudo add-apt-repository universe
wget https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
chmod u+x nvim.appimage
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
ln -s $(pwd) ~/.local/share/nvim/site/pack/nvim-treesitter/start
- name: Compile parsers
run: ./nvim.appimage --headless -c "TSInstallSync all" -c "q"
- name: Check README
run: ./nvim.appimage --headless -c "luafile ./scripts/update-readme.lua" -c "q"

View file

@ -330,40 +330,43 @@ We are looking for maintainers to write query files for their languages.
List of currently supported languages: List of currently supported languages:
- [x] bash (maintained by @TravonteD) <!--Update this section by running `nvim --headless -c "luafile ./scripts/update-readme.lua"`-->
- [x] c (maintained by @vigoux) <!--parserinfo-->
- [x] cpp (maintained by @theHamsta, extends C queries) - [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
- [x] csharp (maintained by @svermeulen) - [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
- [x] css (maintained by @TravonteD) - [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @svermeulen)
- [x] dart (maintained by @Akin909) - [x] [cpp](https://github.com/tree-sitter/tree-sitter-cpp) (maintained by @theHamsta)
- [ ] elm - [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD)
- [x] fennel (maintained by @TravonteD) - [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @Akin909)
- [x] go (maintained by @theHamsta, @WinWisely268) - [ ] [elm](https://github.com/razzeee/tree-sitter-elm)
- [ ] haskell - [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
- [x] html (maintained by @TravonteD) - [x] [go](https://github.com/tree-sitter/tree-sitter-go) (maintained by @theHamsta, @WinWisely268)
- [x] java - [ ] [haskell](https://github.com/tree-sitter/tree-sitter-haskell)
- [x] javascript (maintained by @steelsojka) - [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD)
- [ ] jsdoc - [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f)
- [x] json (maintained by @steelsojka) - [x] [javascript](https://github.com/tree-sitter/tree-sitter-javascript) (maintained by @steelsojka)
- [ ] julia - [x] [jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) (maintained by @steelsojka)
- [x] lua (maintained by @vigoux) - [x] [json](https://github.com/tree-sitter/tree-sitter-json) (maintained by @steelsojka)
- [ ] markdown - [ ] [julia](https://github.com/tree-sitter/tree-sitter-julia)
- [ ] nix - [x] [lua](https://github.com/nvim-treesitter/tree-sitter-lua) (maintained by @vigoux)
- [ ] ocaml - [ ] [markdown](https://github.com/ikatyang/tree-sitter-markdown)
- [x] php (maintained by @tk-shirasaka) - [ ] [nix](https://github.com/cstrahan/tree-sitter-nix)
- [x] python (maintained by @theHamsta) - [x] [ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
- [x] regex (maintained by @theHamsta) - [x] [php](https://github.com/tree-sitter/tree-sitter-php) (maintained by @tk-shirasaka)
- [x] rst (maintained by @stsewd) - [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta)
- [x] ruby (maintained by @TravonteD) - [x] [Tree-sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
- [x] rust (partial support, maintained by @vigoux) - [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta)
- [ ] scala - [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd)
- [ ] swift - [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
- [x] toml (maintained by @tk-shirasaka) - [x] [rust](https://github.com/tree-sitter/tree-sitter-rust) (maintained by @vigoux)
- [x] tree-sitter query language (maintained by @steelsojka) - [ ] [scala](https://github.com/tree-sitter/tree-sitter-scala)
- [ ] tsx - [ ] [swift](https://github.com/tree-sitter/tree-sitter-swift)
- [x] typescript (maintained by @steelsojka) - [x] [toml](https://github.com/ikatyang/tree-sitter-toml) (maintained by @tk-shirasaka)
- [ ] vue - [ ] [tsx](https://github.com/tree-sitter/tree-sitter-typescript)
- [ ] yaml - [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka)
- [ ] [vue](https://github.com/ikatyang/tree-sitter-vue)
- [ ] [yaml](https://github.com/ikatyang/tree-sitter-yaml)
<!--parserinfo-->
# Roadmap # Roadmap

View file

@ -8,14 +8,16 @@ list.javascript = {
url = "https://github.com/tree-sitter/tree-sitter-javascript", url = "https://github.com/tree-sitter/tree-sitter-javascript",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
}, },
used_by = { 'javascriptreact' } used_by = { 'javascriptreact' },
maintainers = {"@steelsojka"},
} }
list.c = { list.c = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-c", url = "https://github.com/tree-sitter/tree-sitter-c",
files = { "src/parser.c" } files = { "src/parser.c" }
} },
maintainers = {"@vigoux"},
} }
list.cpp = { list.cpp = {
@ -24,41 +26,47 @@ list.cpp = {
files = { "src/parser.c", "src/scanner.cc" } files = { "src/parser.c", "src/scanner.cc" }
}, },
used_by = { "cuda" }, used_by = { "cuda" },
maintainers = {"@theHamsta"},
} }
list.rust = { list.rust = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-rust", url = "https://github.com/tree-sitter/tree-sitter-rust",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
} },
maintainers = {"@vigoux"},
} }
list.lua = { list.lua = {
install_info = { install_info = {
url = "https://github.com/nvim-treesitter/tree-sitter-lua", url = "https://github.com/nvim-treesitter/tree-sitter-lua",
files = { "src/parser.c", "src/scanner.cc" } files = { "src/parser.c", "src/scanner.cc" }
} },
maintainers = {"@vigoux"},
} }
list.python = { list.python = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-python", url = "https://github.com/tree-sitter/tree-sitter-python",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} },
maintainers = {'@stsewd', "@theHamsta"},
} }
list.go = { list.go = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-go", url = "https://github.com/tree-sitter/tree-sitter-go",
files = { "src/parser.c" }, files = { "src/parser.c" },
} },
maintainers = {"@theHamsta", "@WinWisely268"},
} }
list.ruby = { list.ruby = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ruby", url = "https://github.com/tree-sitter/tree-sitter-ruby",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} },
maintainers = {'@TravonteD'},
} }
list.bash = { list.bash = {
@ -67,28 +75,32 @@ list.bash = {
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
}, },
used_by = { "zsh" }, used_by = { "zsh" },
filetype = 'sh' filetype = 'sh',
maintainers = {"@TravonteD"},
} }
list.php = { list.php = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-php", url = "https://github.com/tree-sitter/tree-sitter-php",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} },
maintainers = {"@tk-shirasaka"},
} }
list.java = { list.java = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-java", url = "https://github.com/tree-sitter/tree-sitter-java",
files = { "src/parser.c" }, files = { "src/parser.c" },
} },
maintainers = {"@p00f"},
} }
list.html = { list.html = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-html", url = "https://github.com/tree-sitter/tree-sitter-html",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} },
maintainers = {"@TravonteD"},
} }
list.julia = { list.julia = {
@ -102,21 +114,24 @@ list.json = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-json", url = "https://github.com/tree-sitter/tree-sitter-json",
files = { "src/parser.c" }, files = { "src/parser.c" },
} },
maintainers = {"@steelsojka"},
} }
list.css = { list.css = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-css", url = "https://github.com/tree-sitter/tree-sitter-css",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
} },
maintainers = {"@TravonteD"},
} }
list.ocaml = { list.ocaml = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-ocaml", url = "https://github.com/tree-sitter/tree-sitter-ocaml",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} },
maintainers = {'@undu'},
} }
list.swift = { list.swift = {
@ -131,7 +146,8 @@ list.c_sharp = {
url = "https://github.com/tree-sitter/tree-sitter-c-sharp", url = "https://github.com/tree-sitter/tree-sitter-c-sharp",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
}, },
filetype = 'cs' filetype = 'cs',
maintainers = {'@svermeulen'},
} }
list.typescript = { list.typescript = {
@ -139,7 +155,8 @@ list.typescript = {
url = "https://github.com/tree-sitter/tree-sitter-typescript", url = "https://github.com/tree-sitter/tree-sitter-typescript",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
location = "tree-sitter-typescript/typescript" location = "tree-sitter-typescript/typescript"
} },
maintainers = {"@steelsojka"},
} }
list.tsx = { list.tsx = {
@ -177,7 +194,8 @@ list.toml = {
install_info = { install_info = {
url = "https://github.com/ikatyang/tree-sitter-toml", url = "https://github.com/ikatyang/tree-sitter-toml",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
} },
maintainers = {"@tk-shirasaka"},
} }
list.vue = { list.vue = {
@ -189,7 +207,7 @@ list.vue = {
list.elm = { list.elm = {
install_info = { install_info = {
url = "https://github.com//razzeee/tree-sitter-elm", url = "https://github.com/razzeee/tree-sitter-elm",
files = { "src/parser.c", "src/scanner.cc" }, files = { "src/parser.c", "src/scanner.cc" },
} }
} }
@ -212,21 +230,24 @@ list.dart = {
install_info = { install_info = {
url = "https://github.com/UserNobody14/tree-sitter-dart", url = "https://github.com/UserNobody14/tree-sitter-dart",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
} },
maintainers = {"@Akin909"},
} }
list.rst = { list.rst = {
install_info = { install_info = {
url = "https://github.com/stsewd/tree-sitter-rst", url = "https://github.com/stsewd/tree-sitter-rst",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
} },
maintainers = {"@stsewd"},
} }
list.fennel = { list.fennel = {
install_info = { install_info = {
url = "https://github.com/travonted/tree-sitter-fennel", url = "https://github.com/travonted/tree-sitter-fennel",
files = { "src/parser.c" }, files = { "src/parser.c" },
} },
maintainers = {'@TravonteD'},
} }
-- Parsers for injections -- Parsers for injections
@ -234,21 +255,25 @@ list.regex = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-regex", url = "https://github.com/tree-sitter/tree-sitter-regex",
files = { "src/parser.c" } files = { "src/parser.c" }
} },
maintainers = {"@theHamsta"},
} }
list.jsdoc = { list.jsdoc = {
install_info = { install_info = {
url = "https://github.com/tree-sitter/tree-sitter-jsdoc", url = "https://github.com/tree-sitter/tree-sitter-jsdoc",
files = { "src/parser.c" } files = { "src/parser.c" }
} },
maintainers = {"@steelsojka"},
} }
list.query = { list.query = {
install_info = { install_info = {
url = "https://github.com/nvim-treesitter/tree-sitter-query", url = "https://github.com/nvim-treesitter/tree-sitter-query",
files = { "src/parser.c" } files = { "src/parser.c" }
} },
readme_name = "Tree-sitter query language",
maintainers = {"@steelsojka"},
} }
local M = { local M = {
@ -343,3 +368,5 @@ function M.get_buf_lang(bufnr)
end end
return M return M

38
scripts/update-readme.lua Executable file
View file

@ -0,0 +1,38 @@
-- Execute as `nvim --headless -c "luafile ./scripts/update-readme.lua"`
local parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
local sorted_parsers = {}
for k, v in pairs(parsers) do
table.insert(sorted_parsers, {name = k, parser = v})
end
table.sort(sorted_parsers, function(a, b) return a.name < b.name end)
local generated_text = ''
for _, v in ipairs(sorted_parsers) do
local link = '['..(v.parser.readme_name or v.name)..']('..v.parser.install_info.url..')'
if v.parser.maintainers then
generated_text = generated_text..
'- [x] '..link..' (maintained by '..table.concat(v.parser.maintainers, ', ')..')\n'
else
generated_text = generated_text..
'- [ ] '..link..'\n'
end
end
print(generated_text)
print("\n")
local readme_text = table.concat(vim.fn.readfile('README.md'), '\n')
local new_readme_text = string.gsub(readme_text, "<!%-%-parserinfo%-%->.*<!%-%-parserinfo%-%->",
"<!--parserinfo-->\n"..generated_text.."<!--parserinfo-->")
vim.fn.writefile(vim.fn.split(new_readme_text, '\n'), "README.md")
if string.find(readme_text, generated_text, 1, 'plain') then
vim.cmd('q')
else
vim.cmd('cq')
end