From 8734a26c3c138cd509f6eda4b5e9294902947ed2 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 2 Feb 2020 19:11:59 -0800 Subject: docgen.lua: require() all configs Since 6d380677502d, configs are lazy-loaded. So docgen.lua needs to require() them explicitly. --- scripts/README_template.md | 6 +++--- scripts/docgen.lua | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/README_template.md b/scripts/README_template.md index 044fd4b3..98c9aa4e 100644 --- a/scripts/README_template.md +++ b/scripts/README_template.md @@ -14,11 +14,11 @@ Update Nvim and nvim-lsp before reporting an issue. There are many language servers in the world, and not enough time. Help us create configs for *all the LSPs!* -0. Read [CONTRIBUTING.md](CONTRIBUTING.md) for instructions. +1. Read [CONTRIBUTING.md](CONTRIBUTING.md) for instructions. Ask questions in [Neovim Gitter](https://gitter.im/neovim/neovim). -1. Choose a language from [the coc.nvim wiki](https://github.com/neoclide/coc.nvim/wiki/Language-servers) or +2. Choose a language from [the coc.nvim wiki](https://github.com/neoclide/coc.nvim/wiki/Language-servers) or [the emacs-lsp project](https://github.com/emacs-lsp/lsp-mode#supported-languages). -2. Create a new file at `lua/nvim_lsp/SERVER_NAME.lua`. See +3. Create a new file at `lua/nvim_lsp/SERVER_NAME.lua`. See [existing configs](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/) for examples (`lua/nvim_lsp/texlab.lua` is an extensive example). diff --git a/scripts/docgen.lua b/scripts/docgen.lua index bedadba4..3e753972 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -74,7 +74,16 @@ require'nvim_lsp'.{{template_name}}.setup{} ``` ]] +local function require_all_configs() + -- Configs are lazy-loaded, tickle them to populate the `configs` singleton. + for _,v in ipairs(vim.fn.glob('lua/nvim_lsp/*.lua', 1, 1)) do + local module_name = v:gsub('.*/', ''):gsub('%.lua$', '') + require('nvim_lsp/'..module_name) + end +end + local function make_lsp_sections() + require_all_configs() return make_section(0, '\n', sorted_map_table(configs, function(template_name, template_object) local template_def = template_object.document_config local docs = template_def.docs -- cgit v1.2.3-70-g09d2