docs: start documenting previewers (#574)

Co-authored-by: Muhammed Zakir <MuhammedZakir@users.noreply.github.com>
This commit is contained in:
Simon Hauser
2021-03-03 18:14:46 +01:00
committed by GitHub
parent 3ee53c892d
commit 3faca0802f
9 changed files with 736 additions and 151 deletions

View File

@@ -12,6 +12,7 @@ local telescope = {}
--- Telescope.nvim is a plugin for fuzzy finding and neovim. It helps you search,
--- filter, find and pick things in Lua.
---
--- <pre>
--- To find out more:
--- https://github.com/nvim-telescope/telescope.nvim
---
@@ -19,6 +20,7 @@ local telescope = {}
--- :h telescope.builtin
--- :h telescope.layout
--- :h telescope.actions
--- </pre>
---@brief ]]
---@tag telescope.nvim
@@ -50,7 +52,7 @@ function telescope.load_extension(name)
return _extensions.load(name)
end
--- Use telescope.extensions to reference any extensions within your configuration.
--- Use telescope.extensions to reference any extensions within your configuration. <br>
--- While the docs currently generate this as a function, it's actually a table. Sorry.
telescope.extensions = require('telescope._extensions').manager
@@ -60,16 +62,19 @@ telescope.__format_setup_keys = function()
local names = vim.tbl_keys(descriptions)
table.sort(names)
local result = { "", "", "Valid keys for {opts.defaults}" }
local result = { "<pre>", "", "Valid keys for {opts.defaults}" }
for _, name in ipairs(names) do
local desc = descriptions[name]
table.insert(result, "")
table.insert(result, string.format("%s*telescope.defaults.%s*", string.rep(" ", 70 - 20 - #name), name))
table.insert(result, string.format("%s: ~", name))
table.insert(result, string.format(" %s", desc))
for _, line in ipairs(vim.split(desc, '\n')) do
table.insert(result, string.format(" %s", line))
end
end
table.insert(result, '</pre>')
return result
end