diff options
| -rw-r--r-- | CONTRIBUTING.md | 9 | ||||
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | scripts/README_template.md (renamed from README_preamble.md) | 6 | ||||
| -rw-r--r-- | scripts/docgen.lua | 40 |
4 files changed, 33 insertions, 26 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1495e8af..e1d370c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,13 +16,12 @@ from `nvim` to run. It **must** be run from the .git/project root. This could be modified to try to find the .git root with one of our `util.*` functions potentially. -You can run -`nvim -u NONE +'set rtp+=$PWD' +"luafile scripts/docgen.lua" +q` -from the project root. This ensures that it doesn't pick up another -copy of `nvim_lsp` on your system. +You can run `scripts/docgen.sh` from the project root. This ensures that it +doesn't pick up another copy of `nvim_lsp` on your system. -This generates a suffix for README.md +This generates README.md +**DO NOT MODIFY `README.md` DIRECTLY** # skeleton @@ -17,7 +17,8 @@ There's a lot of language servers in the world, and not enough time. See [`lua/nvim_lsp/*.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/) for examples and ask us questions in the [Neovim Gitter](https://gitter.im/neovim/neovim) to help us complete configurations for -*all the LSPs!* Read `CONTRIBUTING.md` for some instructions. +*all the LSPs!* Read `CONTRIBUTING.md` for some instructions. NOTE: don't +modify `README.md`; it is auto-generated. If you don't know where to start, you can pick one that's not in progress or implemented from [this excellent list compiled by the coc.nvim @@ -446,3 +447,4 @@ nvim_lsp#setup("tsserver", {config}) root_dir = root_pattern("package.json") settings = {} ``` + diff --git a/README_preamble.md b/scripts/README_template.md index a932156b..049101bd 100644 --- a/README_preamble.md +++ b/scripts/README_template.md @@ -17,7 +17,8 @@ There's a lot of language servers in the world, and not enough time. See [`lua/nvim_lsp/*.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/) for examples and ask us questions in the [Neovim Gitter](https://gitter.im/neovim/neovim) to help us complete configurations for -*all the LSPs!* Read `CONTRIBUTING.md` for some instructions. +*all the LSPs!* Read `CONTRIBUTING.md` for some instructions. NOTE: don't +modify `README.md`; it is auto-generated. If you don't know where to start, you can pick one that's not in progress or implemented from [this excellent list compiled by the coc.nvim @@ -31,6 +32,7 @@ them are good references. ## Progress Implemented language servers: +{{implemented_servers_list}} Planned servers to implement (by me, but contributions welcome anyway): - [ccls](https://github.com/MaskRay/ccls) @@ -168,3 +170,5 @@ nvim_lsp.SERVER.setup({config}) ``` # LSP Implementations + +{{lsp_server_details}} diff --git a/scripts/docgen.lua b/scripts/docgen.lua index e33e88d0..a430e70b 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -53,7 +53,7 @@ local skeleton_keys = vim.tbl_keys(skeleton) table.sort(skeleton_keys) local function make_lsp_sections() - return map_list(skeleton_keys, function(k) + local sections = map_list(skeleton_keys, function(k) local v = skeleton[k] local tconf = v.template_config @@ -123,30 +123,32 @@ nvim_lsp#setup("{{template_name}}", {config}) ``` ]], params) end) + return table.concat(sections, '\n') end -local function make_readme_preamble() - local data = io.open("README_preamble.md"):read("*a") - local implemented_server_marker = "Implemented language servers:" - return data:gsub(implemented_server_marker, function() - local lines = vim.tbl_flatten { - implemented_server_marker; - map_list(skeleton_keys, function(k) - return template("- [{{server}}](https://github.com/neovim/nvim-lsp#{{server}})", {server=k}) - end) - } - return table.concat(lines, '\n') +local function make_implemented_servers_list() + local parts = map_list(skeleton_keys, function(k) + return template("- [{{server}}](https://github.com/neovim/nvim-lsp#{{server}})", {server=k}) end) + return table.concat(parts, '\n') end -local writer = io.open("README.md", "w") +local function generate_readme(params) + vim.validate { + lsp_server_details = {params.lsp_server_details, 's'}; + implemented_servers_list = {params.implemented_servers_list, 's'}; + } + local input_template = io.open("scripts/README_template.md"):read("*a") + local readme_data = template(input_template, params) -local parts = vim.tbl_flatten { - make_readme_preamble(); - make_lsp_sections(); -} + local writer = io.open("README.md", "w") + writer:write(readme_data) + writer:close() +end -writer:write(table.concat(parts, '\n')) -writer:close() +generate_readme { + implemented_servers_list = make_implemented_servers_list(); + lsp_server_details = make_lsp_sections(); +} -- vim:et ts=2 sw=2 |
