ci: docgen

This commit is contained in:
Folke Lemaitre 2024-12-10 11:21:09 +01:00
parent 22c5ffd12c
commit f2135f2fe2
11 changed files with 395 additions and 140 deletions

View file

@ -41,6 +41,7 @@ Table of Contents *snacks-init-table-of-contents*
---@field dim? snacks.dim.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field indent? snacks.indent.Config
---@field input? snacks.input.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field profiler? snacks.profiler.Config

159
doc/snacks-input.txt Normal file
View file

@ -0,0 +1,159 @@
*snacks-input.txt* snacks.nvim
==============================================================================
Table of Contents *snacks-input-table-of-contents*
1. Setup |snacks-input-setup|
2. Config |snacks-input-config|
3. Styles |snacks-input-styles|
- input |snacks-input-styles-input|
4. Types |snacks-input-types|
5. Module |snacks-input-module|
- Snacks.input() |snacks-input-module-snacks.input()|
- Snacks.input.complete() |snacks-input-module-snacks.input.complete()|
- Snacks.input.disable() |snacks-input-module-snacks.input.disable()|
- Snacks.input.enable() |snacks-input-module-snacks.input.enable()|
- Snacks.input.health() |snacks-input-module-snacks.input.health()|
- Snacks.input.input() |snacks-input-module-snacks.input.input()|
- Snacks.input.test() |snacks-input-module-snacks.input.test()|
==============================================================================
1. Setup *snacks-input-setup*
>lua
-- lazy.nvim
{
"folke/snacks.nvim",
opts = {
input = {
-- your input configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
<
==============================================================================
2. Config *snacks-input-config*
>lua
---@class snacks.input.Config
---@field enabled? boolean
---@field win? snacks.win.Config
---@field icon? string
{
icon = " ",
icon_hl = "SnacksInputIcon",
win = { style = "input" },
expand = true,
}
<
==============================================================================
3. Styles *snacks-input-styles*
INPUT *snacks-input-styles-input*
>lua
{
backdrop = false,
position = "float",
border = "rounded",
title_pos = "center",
height = 1,
width = 60,
relative = "editor",
row = 2,
-- relative = "cursor",
-- row = -3,
-- col = 0,
wo = {
winhighlight = "NormalFloat:SnacksInputNormal,FloatBorder:SnacksInputBorder,FloatTitle:SnacksInputTitle",
},
keys = {
i_esc = { "<esc>", { "cmp_close", "cancel" }, mode = "i" },
-- i_esc = { "<esc>", "stopinsert", mode = "i" },
i_cr = { "<cr>", { "cmp_accept", "confirm" }, mode = "i" },
i_tab = { "<tab>", { "cmp_select_next", "cmp" }, mode = "i" },
q = "cancel",
},
}
<
==============================================================================
4. Types *snacks-input-types*
>lua
---@class snacks.input.Opts: snacks.input.Config
---@field prompt? string
---@field default? string
---@field completion? string
---@field highlight? fun()
<
==============================================================================
5. Module *snacks-input-module*
`Snacks.input()` *Snacks.input()*
>lua
---@type fun(opts: snacks.input.Opts, on_confirm: fun(value?: string)): snacks.win
Snacks.input()
<
`Snacks.input.complete()` *Snacks.input.complete()*
>lua
---@param findstart number
---@param base string
Snacks.input.complete(findstart, base)
<
`Snacks.input.disable()` *Snacks.input.disable()*
>lua
Snacks.input.disable()
<
`Snacks.input.enable()` *Snacks.input.enable()*
>lua
Snacks.input.enable()
<
`Snacks.input.health()` *Snacks.input.health()*
>lua
Snacks.input.health()
<
`Snacks.input.input()` *Snacks.input.input()*
>lua
---@param opts? snacks.input.Opts
---@param on_confirm fun(value?: string)
Snacks.input.input(opts, on_confirm)
<
`Snacks.input.test()` *Snacks.input.test()*
>lua
Snacks.input.test()
<
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl:

48
doc/snacks-meta.txt Normal file
View file

@ -0,0 +1,48 @@
*snacks-meta.txt* snacks.nvim
==============================================================================
Table of Contents *snacks-meta-table-of-contents*
1. Types |snacks-meta-types|
2. Module |snacks-meta-module|
- Snacks.meta.get() |snacks-meta-module-snacks.meta.get()|
==============================================================================
1. Types *snacks-meta-types*
>lua
---@class snacks.meta.Meta
---@field desc string
---@field needs_setup? boolean
---@field hide? boolean
---@field readme? boolean
---@field docs? boolean
---@field health? boolean
---@field types? boolean
---@field config? boolean
<
>lua
---@class snacks.meta.Plugin
---@field name string
---@field file string
---@field meta snacks.meta.Meta
---@field health? fun()
<
==============================================================================
2. Module *snacks-meta-module*
`Snacks.meta.get()` *Snacks.meta.get()*
Get the metadata for all snacks plugins
>lua
Snacks.meta.get()
<
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl:

View file

@ -1,70 +0,0 @@
*snacks-types.txt* snacks.nvim
==============================================================================
Table of Contents *snacks-types-table-of-contents*
1. Types |snacks-types-types|
==============================================================================
1. Types *snacks-types-types*
>lua
---@meta _
<
>lua
---@class snacks.plugins
---@field animate snacks.animate
---@field bigfile snacks.bigfile
---@field bufdelete snacks.bufdelete
---@field dashboard snacks.dashboard
---@field debug snacks.debug
---@field dim snacks.dim
---@field git snacks.git
---@field gitbrowse snacks.gitbrowse
---@field health snacks.health
---@field indent snacks.indent
---@field lazygit snacks.lazygit
---@field notifier snacks.notifier
---@field notify snacks.notify
---@field profiler snacks.profiler
---@field quickfile snacks.quickfile
---@field rename snacks.rename
---@field scope snacks.scope
---@field scratch snacks.scratch
---@field scroll snacks.scroll
---@field statuscolumn snacks.statuscolumn
---@field terminal snacks.terminal
---@field toggle snacks.toggle
---@field util snacks.util
---@field win snacks.win
---@field words snacks.words
---@field zen snacks.zen
<
>lua
---@class snacks.plugins.Config
---@field animate? snacks.animate.Config
---@field bigfile? snacks.bigfile.Config
---@field dashboard? snacks.dashboard.Config
---@field dim? snacks.dim.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field indent? snacks.indent.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field profiler? snacks.profiler.Config
---@field quickfile? snacks.quickfile.Config
---@field scope? snacks.scope.Config
---@field scratch? snacks.scratch.Config
---@field scroll? snacks.scroll.Config
---@field statuscolumn? snacks.statuscolumn.Config
---@field terminal? snacks.terminal.Config
---@field toggle? snacks.toggle.Config
---@field win? snacks.win.Config
---@field words? snacks.words.Config
---@field zen? snacks.zen.Config
<
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl:

View file

@ -14,6 +14,7 @@ Table of Contents *snacks-win-table-of-contents*
6. Module |snacks-win-module|
- Snacks.win() |snacks-win-module-snacks.win()|
- Snacks.win.new() |snacks-win-module-snacks.win.new()|
- win:action() |snacks-win-module-win:action()|
- win:add_padding() |snacks-win-module-win:add_padding()|
- win:border_text_width() |snacks-win-module-win:border_text_width()|
- win:buf_valid() |snacks-win-module-win:buf_valid()|
@ -79,8 +80,8 @@ Easily create and manage floating windows or splits
---@class snacks.win.Config: vim.api.keyset.win_config
---@field style? string merges with config from `Snacks.config.styles[style]`
---@field show? boolean Show the window immediately (default: true)
---@field height? number|fun():number Height of the window. Use <1 for relative height. 0 means full height. (default: 0.9)
---@field width? number|fun():number Width of the window. Use <1 for relative width. 0 means full width. (default: 0.9)
---@field height? number|fun(self:snacks.win):number Height of the window. Use <1 for relative height. 0 means full height. (default: 0.9)
---@field width? number|fun(self:snacks.win):number Width of the window. Use <1 for relative width. 0 means full width. (default: 0.9)
---@field minimal? boolean Disable a bunch of options to make the window minimal (default: true)
---@field position? "float"|"bottom"|"top"|"left"|"right"
---@field buf? number If set, use this buffer instead of creating a new one
@ -95,6 +96,7 @@ Easily create and manage floating windows or splits
---@field on_win? fun(self: snacks.win) Callback after opening the window
---@field fixbuf? boolean don't allow other buffers to be opened in this window
---@field text? string|string[]|fun():(string[]|string) Initial lines to set in the buffer
---@field actions? table<string, fun(self: snacks.win):(boolean|string?)> Actions that can be used in key mappings
{
show = true,
fixbuf = true,
@ -170,7 +172,7 @@ SPLIT *snacks-win-styles-split*
>lua
---@class snacks.win.Keys: vim.api.keyset.keymap
---@field [1]? string
---@field [2]? string|fun(self: snacks.win): any
---@field [2]? string|string[]|fun(self: snacks.win): string?
---@field mode? string|string[]
<
@ -216,6 +218,15 @@ SPLIT *snacks-win-styles-split*
<
WIN:ACTION() *snacks-win-module-win:action()*
>lua
---@param actions string|string[]
---@return fun(): boolean|string?
win:action(actions)
<
WIN:ADD_PADDING() *snacks-win-module-win:add_padding()*
>lua

View file

@ -28,6 +28,7 @@
---@field dim? snacks.dim.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field indent? snacks.indent.Config
---@field input? snacks.input.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field profiler? snacks.profiler.Config

123
docs/input.md Normal file
View file

@ -0,0 +1,123 @@
# 🍿 input
<!-- docgen -->
## 📦 Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
opts = {
input = {
-- your input configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## ⚙️ Config
```lua
---@class snacks.input.Config
---@field enabled? boolean
---@field win? snacks.win.Config
---@field icon? string
{
icon = " ",
icon_hl = "SnacksInputIcon",
win = { style = "input" },
expand = true,
}
```
## 🎨 Styles
### `input`
```lua
{
backdrop = false,
position = "float",
border = "rounded",
title_pos = "center",
height = 1,
width = 60,
relative = "editor",
row = 2,
-- relative = "cursor",
-- row = -3,
-- col = 0,
wo = {
winhighlight = "NormalFloat:SnacksInputNormal,FloatBorder:SnacksInputBorder,FloatTitle:SnacksInputTitle",
},
keys = {
i_esc = { "<esc>", { "cmp_close", "cancel" }, mode = "i" },
-- i_esc = { "<esc>", "stopinsert", mode = "i" },
i_cr = { "<cr>", { "cmp_accept", "confirm" }, mode = "i" },
i_tab = { "<tab>", { "cmp_select_next", "cmp" }, mode = "i" },
q = "cancel",
},
}
```
## 📚 Types
```lua
---@class snacks.input.Opts: snacks.input.Config
---@field prompt? string
---@field default? string
---@field completion? string
---@field highlight? fun()
```
## 📦 Module
### `Snacks.input()`
```lua
---@type fun(opts: snacks.input.Opts, on_confirm: fun(value?: string)): snacks.win
Snacks.input()
```
### `Snacks.input.complete()`
```lua
---@param findstart number
---@param base string
Snacks.input.complete(findstart, base)
```
### `Snacks.input.disable()`
```lua
Snacks.input.disable()
```
### `Snacks.input.enable()`
```lua
Snacks.input.enable()
```
### `Snacks.input.health()`
```lua
Snacks.input.health()
```
### `Snacks.input.input()`
```lua
---@param opts? snacks.input.Opts
---@param on_confirm fun(value?: string)
Snacks.input.input(opts, on_confirm)
```
### `Snacks.input.test()`
```lua
Snacks.input.test()
```

35
docs/meta.md Normal file
View file

@ -0,0 +1,35 @@
# 🍿 meta
<!-- docgen -->
## 📚 Types
```lua
---@class snacks.meta.Meta
---@field desc string
---@field needs_setup? boolean
---@field hide? boolean
---@field readme? boolean
---@field docs? boolean
---@field health? boolean
---@field types? boolean
---@field config? boolean
```
```lua
---@class snacks.meta.Plugin
---@field name string
---@field file string
---@field meta snacks.meta.Meta
---@field health? fun()
```
## 📦 Module
### `Snacks.meta.get()`
Get the metadata for all snacks plugins
```lua
Snacks.meta.get()
```

View file

@ -1,62 +0,0 @@
# 🍿 types
<!-- docgen -->
## 📚 Types
```lua
---@meta _
```
```lua
---@class snacks.plugins
---@field animate snacks.animate
---@field bigfile snacks.bigfile
---@field bufdelete snacks.bufdelete
---@field dashboard snacks.dashboard
---@field debug snacks.debug
---@field dim snacks.dim
---@field git snacks.git
---@field gitbrowse snacks.gitbrowse
---@field health snacks.health
---@field indent snacks.indent
---@field lazygit snacks.lazygit
---@field notifier snacks.notifier
---@field notify snacks.notify
---@field profiler snacks.profiler
---@field quickfile snacks.quickfile
---@field rename snacks.rename
---@field scope snacks.scope
---@field scratch snacks.scratch
---@field scroll snacks.scroll
---@field statuscolumn snacks.statuscolumn
---@field terminal snacks.terminal
---@field toggle snacks.toggle
---@field util snacks.util
---@field win snacks.win
---@field words snacks.words
---@field zen snacks.zen
```
```lua
---@class snacks.plugins.Config
---@field animate? snacks.animate.Config
---@field bigfile? snacks.bigfile.Config
---@field dashboard? snacks.dashboard.Config
---@field dim? snacks.dim.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field indent? snacks.indent.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field profiler? snacks.profiler.Config
---@field quickfile? snacks.quickfile.Config
---@field scope? snacks.scope.Config
---@field scratch? snacks.scratch.Config
---@field scroll? snacks.scroll.Config
---@field statuscolumn? snacks.statuscolumn.Config
---@field terminal? snacks.terminal.Config
---@field toggle? snacks.toggle.Config
---@field win? snacks.win.Config
---@field words? snacks.words.Config
---@field zen? snacks.zen.Config
```

View file

@ -44,8 +44,8 @@ Snacks.win({
---@class snacks.win.Config: vim.api.keyset.win_config
---@field style? string merges with config from `Snacks.config.styles[style]`
---@field show? boolean Show the window immediately (default: true)
---@field height? number|fun():number Height of the window. Use <1 for relative height. 0 means full height. (default: 0.9)
---@field width? number|fun():number Width of the window. Use <1 for relative width. 0 means full width. (default: 0.9)
---@field height? number|fun(self:snacks.win):number Height of the window. Use <1 for relative height. 0 means full height. (default: 0.9)
---@field width? number|fun(self:snacks.win):number Width of the window. Use <1 for relative width. 0 means full width. (default: 0.9)
---@field minimal? boolean Disable a bunch of options to make the window minimal (default: true)
---@field position? "float"|"bottom"|"top"|"left"|"right"
---@field buf? number If set, use this buffer instead of creating a new one
@ -60,6 +60,7 @@ Snacks.win({
---@field on_win? fun(self: snacks.win) Callback after opening the window
---@field fixbuf? boolean don't allow other buffers to be opened in this window
---@field text? string|string[]|fun():(string[]|string) Initial lines to set in the buffer
---@field actions? table<string, fun(self: snacks.win):(boolean|string?)> Actions that can be used in key mappings
{
show = true,
fixbuf = true,
@ -128,7 +129,7 @@ Snacks.win({
```lua
---@class snacks.win.Keys: vim.api.keyset.keymap
---@field [1]? string
---@field [2]? string|fun(self: snacks.win): any
---@field [2]? string|string[]|fun(self: snacks.win): string?
---@field mode? string|string[]
```
@ -169,6 +170,14 @@ Snacks.win()
Snacks.win.new(opts)
```
### `win:action()`
```lua
---@param actions string|string[]
---@return fun(): boolean|string?
win:action(actions)
```
### `win:add_padding()`
```lua

View file

@ -2,7 +2,7 @@
set -e
nvim -u tests/minit.lua --headless +'lua require("snacks.docs").build()' +qa
nvim -u tests/minit.lua --headless +'lua require("snacks.meta.docs").build()' +qa
echo -e "\n\nGenerating Vim Help"
@ -22,4 +22,4 @@ for f in docs/*.md; do
--shift-heading-level-by -1
done
nvim -u tests/minit.lua --headless +'lua require("snacks.docs").fix_titles()' +qa
nvim -u tests/minit.lua --headless +'lua require("snacks.meta.docs").fix_titles()' +qa