Skip to content

Commit d698a6f

Browse files
committed
docs: switch out docgen tool
1 parent dc6fc32 commit d698a6f

28 files changed

+2531
-2969
lines changed

.github/workflows/docgen.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
include:
1919
- os: ubuntu-22.04
20-
url: https://github.com/neovim/neovim/releases/download/v0.9.5/nvim-linux64.tar.gz
20+
url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz
2121
steps:
2222
- uses: actions/checkout@v4
2323
- run: date +%F > todays-date
@@ -35,17 +35,8 @@ jobs:
3535
}
3636
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
3737
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
38-
git clone https://github.com/tjdevries/tree-sitter-lua ~/.local/share/nvim/site/pack/vendor/start/tree-sitter-lua
3938
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
4039
41-
- name: Build parser
42-
run: |
43-
# We have to build the parser every single time to keep up with parser changes
44-
cd ~/.local/share/nvim/site/pack/vendor/start/tree-sitter-lua
45-
git checkout 86f74dfb69c570f0749b241f8f5489f8f50adbea
46-
make dist
47-
cd -
48-
4940
- name: Generating docs
5041
run: |
5142
export PATH="${PWD}/_neovim/bin:${PATH}"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ lint:
77
luacheck lua/telescope
88

99
docgen:
10-
nvim --headless --noplugin -u scripts/minimal_init.vim -c "luafile ./scripts/gendocs.lua" -c 'qa'
10+
nvim -l scripts/gendocs.lua

doc/telescope.txt

Lines changed: 1635 additions & 2177 deletions
Large diffs are not rendered by default.

lua/telescope/actions/generate.lua

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
---@tag telescope.actions.generate
2-
---@config { ["module"] = "telescope.actions.generate", ["name"] = "ACTIONS_GENERATE" }
3-
4-
---@brief [[
1+
---@brief
52
--- Module for convenience to override defaults of corresponding |telescope.actions| at |telescope.setup()|.
63
---
74
--- General usage:
8-
--- <code>
9-
--- require("telescope").setup {
10-
--- defaults = {
11-
--- mappings = {
12-
--- n = {
13-
--- ["?"] = action_generate.which_key {
14-
--- name_width = 20, -- typically leads to smaller floats
15-
--- max_height = 0.5, -- increase potential maximum height
16-
--- separator = " > ", -- change sep between mode, keybind, and name
17-
--- close_with_action = false, -- do not close float on action
18-
--- },
5+
--- ```lua
6+
--- require("telescope").setup {
7+
--- defaults = {
8+
--- mappings = {
9+
--- n = {
10+
--- ["?"] = action_generate.which_key {
11+
--- name_width = 20, -- typically leads to smaller floats
12+
--- max_height = 0.5, -- increase potential maximum height
13+
--- separator = " > ", -- change sep between mode, keybind, and name
14+
--- close_with_action = false, -- do not close float on action
1915
--- },
2016
--- },
2117
--- },
22-
--- }
23-
--- </code>
24-
---@brief ]]
18+
--- },
19+
--- }
20+
--- ```
2521

2622
local actions = require "telescope.actions"
2723
local config = require "telescope.config"
@@ -30,12 +26,8 @@ local finders = require "telescope.finders"
3026

3127
local action_generate = {}
3228

33-
--- Display the keymaps of registered actions similar to which-key.nvim.<br>
34-
--- - Floating window:
35-
--- - Appears on the opposite side of the prompt.
36-
--- - Resolves to minimum required number of lines to show hints with `opts` or truncates entries at `max_height`.
37-
--- - Closes automatically on action call and can be disabled with by setting `close_with_action` to false.
38-
---@param opts table: options to pass to toggling registered actions
29+
---@inlinedoc
30+
---@class telescope.actions.generate.which_key.opts
3931
---@field max_height number: % of max. height or no. of rows for hints (default: 0.4), see |resolver.resolve_height()|
4032
---@field only_show_current_mode boolean: only show keymaps for the current mode (default: true)
4133
---@field mode_width number: fixed width of mode to be shown (default: 1)
@@ -53,6 +45,13 @@ local action_generate = {}
5345
---@field border_hl string: winhl of "Normal" for keymap borders (default: "TelescopePromptBorder")
5446
---@field winblend number: pseudo-transparency of keymap hints floating window
5547
---@field zindex number: z-index of keymap hints floating window (default: 100)
48+
49+
--- Display the keymaps of registered actions similar to which-key.nvim.
50+
--- - Floating window:
51+
--- - Appears on the opposite side of the prompt.
52+
--- - Resolves to minimum required number of lines to show hints with `opts` or truncates entries at `max_height`.
53+
--- - Closes automatically on action call and can be disabled with by setting `close_with_action` to false.
54+
---@param opts table: options to pass to toggling registered actions
5655
action_generate.which_key = function(opts)
5756
local which_key = function(prompt_bufnr)
5857
actions.which_key(prompt_bufnr, opts)

lua/telescope/actions/history.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ local utils = require "telescope.utils"
44

55
local uv = vim.loop
66

7-
---@tag telescope.actions.history
8-
---@config { ["module"] = "telescope.actions.history" }
9-
10-
---@brief [[
7+
---@brief
118
--- A base implementation of a prompt history that provides a simple history
129
--- and can be replaced with a custom implementation.
1310
---
@@ -24,7 +21,6 @@ local uv = vim.loop
2421
--- - etc
2522
---
2623
--- See https://github.com/nvim-telescope/telescope-smart-history.nvim
27-
---@brief ]]
2824

2925
-- TODO(conni2461): currently not present in plenary path only sync.
3026
-- But sync is just unnecessary here
@@ -57,12 +53,15 @@ local histories = {}
5753
histories.History = {}
5854
histories.History.__index = histories.History
5955

60-
--- Create a new History
61-
---@param opts table: Defines the behavior of History
56+
---@inlinedoc
57+
---@class telescope.actions.history.opts
6258
---@field init function: Will be called after handling configuration (required)
6359
---@field append function: How to append a new prompt item (required)
6460
---@field reset function: What happens on reset. Will be called when telescope closes (required)
6561
---@field pre_get function: Will be called before a next or previous item will be returned (optional)
62+
63+
--- Create a new History
64+
---@param opts table: Defines the behavior of History
6665
function histories.History:new(opts)
6766
local obj = {}
6867
if conf.history == false or type(conf.history) ~= "table" then

lua/telescope/actions/init.lua

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---@tag telescope.actions
2-
---@config { ["module"] = "telescope.actions" }
3-
4-
---@brief [[
1+
---@brief
52
--- These functions are useful for people creating their own mappings.
63
---
74
--- Actions can be either normal functions that expect the `prompt_bufnr` as
@@ -10,47 +7,46 @@
107
--- (1) The `prompt_bufnr` of a normal function denotes the identifier of your
118
--- picker which can be used to access the picker state. In practice, users
129
--- most commonly access from both picker and global state via the following:
13-
--- <code>
14-
--- -- for utility functions
15-
--- local action_state = require "telescope.actions.state"
10+
--- ```lua
11+
--- -- for utility functions
12+
--- local action_state = require "telescope.actions.state"
1613
---
17-
--- local actions = {}
18-
--- actions.do_stuff = function(prompt_bufnr)
19-
--- local current_picker = action_state.get_current_picker(prompt_bufnr) -- picker state
20-
--- local entry = action_state.get_selected_entry()
21-
--- end
22-
--- </code>
14+
--- local actions = {}
15+
--- actions.do_stuff = function(prompt_bufnr)
16+
--- local current_picker = action_state.get_current_picker(prompt_bufnr) -- picker state
17+
--- local entry = action_state.get_selected_entry()
18+
--- end
19+
--- ```
2320
---
2421
--- See |telescope.actions.state| for more information.
2522
---
2623
--- (2) To transform a module of functions into a module of "action"s, you need
2724
--- to do the following:
28-
--- <code>
29-
--- local transform_mod = require("telescope.actions.mt").transform_mod
25+
--- ```lua
26+
--- local transform_mod = require("telescope.actions.mt").transform_mod
3027
---
31-
--- local mod = {}
32-
--- mod.a1 = function(prompt_bufnr)
33-
--- -- your code goes here
34-
--- -- You can access the picker/global state as described above in (1).
35-
--- end
28+
--- local mod = {}
29+
--- mod.a1 = function(prompt_bufnr)
30+
--- -- your code goes here
31+
--- -- You can access the picker/global state as described above in (1).
32+
--- end
3633
---
37-
--- mod.a2 = function(prompt_bufnr)
38-
--- -- your code goes here
39-
--- end
40-
--- mod = transform_mod(mod)
34+
--- mod.a2 = function(prompt_bufnr)
35+
--- -- your code goes here
36+
--- end
37+
--- mod = transform_mod(mod)
4138
---
42-
--- -- Now the following is possible. This means that actions a2 will be executed
43-
--- -- after action a1. You can chain as many actions as you want.
44-
--- local action = mod.a1 + mod.a2
45-
--- action(bufnr)
46-
--- </code>
39+
--- -- Now the following is possible. This means that actions a2 will be executed
40+
--- -- after action a1. You can chain as many actions as you want.
41+
--- local action = mod.a1 + mod.a2
42+
--- action(bufnr)
43+
--- ```
4744
---
4845
--- Another interesting thing to do is that these actions now have functions you
4946
--- can call. These functions include `:replace(f)`, `:replace_if(f, c)`,
5047
--- `replace_map(tbl)` and `enhance(tbl)`. More information on these functions
5148
--- can be found in the `developers.md` and `lua/tests/automated/action_spec.lua`
5249
--- file.
53-
---@brief ]]
5450

5551
local a = vim.api
5652

@@ -156,7 +152,7 @@ actions.toggle_selection = function(prompt_bufnr)
156152
end
157153

158154
--- Multi select all entries.
159-
--- - Note: selected entries may include results not visible in the results pop up.
155+
---@note selected entries may include results not visible in the results pop up.
160156
---@param prompt_bufnr number: The prompt bufnr
161157
actions.select_all = function(prompt_bufnr)
162158
local current_picker = action_state.get_current_picker(prompt_bufnr)
@@ -193,7 +189,7 @@ actions.drop_all = function(prompt_bufnr)
193189
end
194190

195191
--- Toggle multi selection for all entries.
196-
--- - Note: toggled entries may include results not visible in the results pop up.
192+
---@note toggled entries may include results not visible in the results pop up.
197193
---@param prompt_bufnr number: The prompt bufnr
198194
actions.toggle_all = function(prompt_bufnr)
199195
local current_picker = action_state.get_current_picker(prompt_bufnr)
@@ -1255,8 +1251,7 @@ actions.remove_selected_picker = function(prompt_bufnr)
12551251
end
12561252

12571253
--- Display the keymaps of registered actions similar to which-key.nvim.<br>
1258-
--- - Notes:
1259-
--- - The defaults can be overridden via |action_generate.which_key|.
1254+
---@note The defaults can be overridden via |action_generate.which_key|.
12601255
---@param prompt_bufnr number: The prompt bufnr
12611256
actions.which_key = function(prompt_bufnr, opts)
12621257
opts = opts or {}

lua/telescope/actions/layout.lua

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
---@tag telescope.actions.layout
2-
---@config { ["module"] = "telescope.actions.layout", ["name"] = "ACTIONS_LAYOUT" }
3-
4-
---@brief [[
1+
---@brief
52
--- The layout actions are actions to be used to change the layout of a picker.
6-
---@brief ]]
73

84
local action_state = require "telescope.actions.state"
95
local state = require "telescope.state"
@@ -18,9 +14,8 @@ local action_layout = setmetatable({}, {
1814
})
1915

2016
--- Toggle preview window.
21-
--- - Note: preview window can be toggled even if preview is set to false.
22-
---
23-
--- This action is not mapped by default.
17+
---@note preview window can be toggled even if preview is set to false.
18+
---@note this action is not mapped by default.
2419
---@param prompt_bufnr number: The prompt bufnr
2520
action_layout.toggle_preview = function(prompt_bufnr)
2621
local picker = action_state.get_current_picker(prompt_bufnr)
@@ -54,7 +49,7 @@ end
5449
--- Toggles the `prompt_position` option between "top" and "bottom".
5550
--- Checks if `prompt_position` is an option for the current layout.
5651
---
57-
--- This action is not mapped by default.
52+
---@note this action is not mapped by default.
5853
---@param prompt_bufnr number: The prompt bufnr
5954
action_layout.toggle_prompt_position = function(prompt_bufnr)
6055
local picker = action_state.get_current_picker(prompt_bufnr)
@@ -87,7 +82,7 @@ end
8782
--- Toggles the `mirror` option between `true` and `false`.
8883
--- Checks if `mirror` is an option for the current layout.
8984
---
90-
--- This action is not mapped by default.
85+
---@note this action is not mapped by default.
9186
---@param prompt_bufnr number: The prompt bufnr
9287
action_layout.toggle_mirror = function(prompt_bufnr)
9388
local picker = action_state.get_current_picker(prompt_bufnr)
@@ -138,13 +133,13 @@ end
138133

139134
--- Cycles to the next layout in `cycle_layout_list`.
140135
---
141-
--- This action is not mapped by default.
136+
---@note this action is not mapped by default.
142137
---@param prompt_bufnr number: The prompt bufnr
143138
action_layout.cycle_layout_next = get_cycle_layout(1)
144139

145140
--- Cycles to the previous layout in `cycle_layout_list`.
146141
---
147-
--- This action is not mapped by default.
142+
---@note this action is not mapped by default.
148143
---@param prompt_bufnr number: The prompt bufnr
149144
action_layout.cycle_layout_prev = get_cycle_layout(-1)
150145

lua/telescope/actions/set.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
---@tag telescope.actions.set
2-
---@config { ["module"] = "telescope.actions.set", ["name"] = "ACTIONS_SET" }
3-
4-
---@brief [[
1+
---@brief
52
--- Telescope action sets are used to provide an interface for managing
63
--- actions that all primarily do the same thing, but with slight tweaks.
74
---
85
--- For example, when editing files you may want it in the current split,
96
--- a vertical split, etc. Instead of making users have to overwrite EACH
107
--- of those every time they want to change this behavior, they can instead
118
--- replace the `set` itself and then it will work great and they're done.
12-
---@brief ]]
139

1410
local a = vim.api
1511

lua/telescope/actions/state.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
---@tag telescope.actions.state
2-
---@config { ["module"] = "telescope.actions.state", ["name"] = "ACTIONS_STATE" }
3-
4-
---@brief [[
1+
---@brief
52
--- Functions to be used to determine the current state of telescope.
63
---
74
--- Generally used from within other |telescope.actions|
8-
---@brief ]]
95

106
local global_state = require "telescope.state"
117
local conf = require("telescope.config").values
128

139
local action_state = {}
1410

1511
--- Get the current entry
12+
---@return table # the selected entry
1613
function action_state.get_selected_entry()
1714
return global_state.get_global_key "selected_entry"
1815
end
1916

2017
--- Gets the current line in the search prompt
18+
---@return string # the current line in the search prompt
2119
function action_state.get_current_line()
2220
return global_state.get_global_key "current_line" or ""
2321
end
2422

2523
--- Gets the current picker
2624
---@param prompt_bufnr number: The prompt bufnr
25+
---@return table # the current picker
2726
function action_state.get_current_picker(prompt_bufnr)
2827
return global_state.get_status(prompt_bufnr).picker
2928
end

0 commit comments

Comments
 (0)