mirror of
https://github.com/neovim/nvim-lspconfig
synced 2025-04-01 00:30:37 +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
|
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.
|
find the .git root with one of our `util.*` functions potentially.
|
||||||
|
|
||||||
You can run
|
You can run `scripts/docgen.sh` from the project root. This ensures that it
|
||||||
`nvim -u NONE +'set rtp+=$PWD' +"luafile scripts/docgen.lua" +q`
|
doesn't pick up another copy of `nvim_lsp` on your system.
|
||||||
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
|
# 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/)
|
[`lua/nvim_lsp/*.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/)
|
||||||
for examples and ask us questions in the [Neovim
|
for examples and ask us questions in the [Neovim
|
||||||
Gitter](https://gitter.im/neovim/neovim) to help us complete configurations for
|
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
|
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
|
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")
|
root_dir = root_pattern("package.json")
|
||||||
settings = {}
|
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/)
|
[`lua/nvim_lsp/*.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/)
|
||||||
for examples and ask us questions in the [Neovim
|
for examples and ask us questions in the [Neovim
|
||||||
Gitter](https://gitter.im/neovim/neovim) to help us complete configurations for
|
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
|
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
|
implemented from [this excellent list compiled by the coc.nvim
|
||||||
@ -31,6 +32,7 @@ them are good references.
|
|||||||
## Progress
|
## Progress
|
||||||
|
|
||||||
Implemented language servers:
|
Implemented language servers:
|
||||||
|
{{implemented_servers_list}}
|
||||||
|
|
||||||
Planned servers to implement (by me, but contributions welcome anyway):
|
Planned servers to implement (by me, but contributions welcome anyway):
|
||||||
- [ccls](https://github.com/MaskRay/ccls)
|
- [ccls](https://github.com/MaskRay/ccls)
|
||||||
@ -168,3 +170,5 @@ nvim_lsp.SERVER.setup({config})
|
|||||||
```
|
```
|
||||||
|
|
||||||
# LSP Implementations
|
# LSP Implementations
|
||||||
|
|
||||||
|
{{lsp_server_details}}
|
@ -53,7 +53,7 @@ local skeleton_keys = vim.tbl_keys(skeleton)
|
|||||||
table.sort(skeleton_keys)
|
table.sort(skeleton_keys)
|
||||||
|
|
||||||
local function make_lsp_sections()
|
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 v = skeleton[k]
|
||||||
local tconf = v.template_config
|
local tconf = v.template_config
|
||||||
|
|
||||||
@ -123,30 +123,32 @@ nvim_lsp#setup("{{template_name}}", {config})
|
|||||||
```
|
```
|
||||||
]], params)
|
]], params)
|
||||||
end)
|
end)
|
||||||
|
return table.concat(sections, '\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_readme_preamble()
|
local function make_implemented_servers_list()
|
||||||
local data = io.open("README_preamble.md"):read("*a")
|
local parts = map_list(skeleton_keys, function(k)
|
||||||
local implemented_server_marker = "Implemented language servers:"
|
return template("- [{{server}}](https://github.com/neovim/nvim-lsp#{{server}})", {server=k})
|
||||||
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')
|
|
||||||
end)
|
end)
|
||||||
|
return table.concat(parts, '\n')
|
||||||
end
|
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 {
|
local writer = io.open("README.md", "w")
|
||||||
make_readme_preamble();
|
writer:write(readme_data)
|
||||||
make_lsp_sections();
|
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
|
-- vim:et ts=2 sw=2
|
||||||
|
Loading…
Reference in New Issue
Block a user