mirror of
https://github.com/neovim/nvim-lspconfig
synced 2025-03-11 04:27:36 +00:00
Use a template for README.md (#28)
This commit is contained in:
parent
14660af896
commit
ac3df47ffd
@ -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 = {}
|
||||
```
|
||||
|
||||
|
@ -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}}
|
@ -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
|
||||
|
||||
generate_readme {
|
||||
implemented_servers_list = make_implemented_servers_list();
|
||||
lsp_server_details = make_lsp_sections();
|
||||
}
|
||||
|
||||
writer:write(table.concat(parts, '\n'))
|
||||
writer:close()
|
||||
|
||||
-- vim:et ts=2 sw=2
|
||||
|
Loading…
Reference in New Issue
Block a user