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:
- [x] bash (maintained by @TravonteD)
- [x] c (maintained by @vigoux)
- [x] cpp (maintained by @theHamsta, extends C queries)
- [x] csharp (maintained by @svermeulen)
- [x] css (maintained by @TravonteD)
- [x] dart (maintained by @Akin909)
- [ ] elm
- [x] fennel (maintained by @TravonteD)
- [x] go (maintained by @theHamsta, @WinWisely268)
- [ ] haskell
- [x] html (maintained by @TravonteD)
- [x] java
- [x] javascript (maintained by @steelsojka)
- [ ] jsdoc
- [x] json (maintained by @steelsojka)
- [ ] julia
- [x] lua (maintained by @vigoux)
- [ ] markdown
- [ ] nix
- [ ] ocaml
- [x] php (maintained by @tk-shirasaka)
- [x] python (maintained by @theHamsta)
- [x] regex (maintained by @theHamsta)
- [x] rst (maintained by @stsewd)
- [x] ruby (maintained by @TravonteD)
- [x] rust (partial support, maintained by @vigoux)
- [ ] scala
- [ ] swift
- [x] toml (maintained by @tk-shirasaka)
- [x] tree-sitter query language (maintained by @steelsojka)
- [ ] tsx
- [x] typescript (maintained by @steelsojka)
- [ ] vue
- [ ] yaml
<!--Update this section by running `nvim --headless -c "luafile ./scripts/update-readme.lua"`-->
<!--parserinfo-->
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @svermeulen)
- [x] [cpp](https://github.com/tree-sitter/tree-sitter-cpp) (maintained by @theHamsta)
- [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD)
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @Akin909)
- [ ] [elm](https://github.com/razzeee/tree-sitter-elm)
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
- [x] [go](https://github.com/tree-sitter/tree-sitter-go) (maintained by @theHamsta, @WinWisely268)
- [ ] [haskell](https://github.com/tree-sitter/tree-sitter-haskell)
- [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD)
- [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f)
- [x] [javascript](https://github.com/tree-sitter/tree-sitter-javascript) (maintained by @steelsojka)
- [x] [jsdoc](https://github.com/tree-sitter/tree-sitter-jsdoc) (maintained by @steelsojka)
- [x] [json](https://github.com/tree-sitter/tree-sitter-json) (maintained by @steelsojka)
- [ ] [julia](https://github.com/tree-sitter/tree-sitter-julia)
- [x] [lua](https://github.com/nvim-treesitter/tree-sitter-lua) (maintained by @vigoux)
- [ ] [markdown](https://github.com/ikatyang/tree-sitter-markdown)
- [ ] [nix](https://github.com/cstrahan/tree-sitter-nix)
- [x] [ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
- [x] [php](https://github.com/tree-sitter/tree-sitter-php) (maintained by @tk-shirasaka)
- [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta)
- [x] [Tree-sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
- [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta)
- [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd)
- [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
- [x] [rust](https://github.com/tree-sitter/tree-sitter-rust) (maintained by @vigoux)
- [ ] [scala](https://github.com/tree-sitter/tree-sitter-scala)
- [ ] [swift](https://github.com/tree-sitter/tree-sitter-swift)
- [x] [toml](https://github.com/ikatyang/tree-sitter-toml) (maintained by @tk-shirasaka)
- [ ] [tsx](https://github.com/tree-sitter/tree-sitter-typescript)
- [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

View file

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