docs: add module prefix (#1847)

This commit is contained in:
Simon Hauser
2022-04-18 08:21:00 +02:00
committed by GitHub
parent 66c3e2a351
commit 831f76a809
14 changed files with 234 additions and 228 deletions

View File

@@ -1,4 +1,5 @@
---@tag telescope.actions.generate
---@config { ["module"] = "telescope.actions.generate" }
---@brief [[
--- Module for convenience to override defaults of corresponding |telescope.actions| at |telescope.setup()|.

View File

@@ -4,6 +4,9 @@ local utils = require "telescope.utils"
local uv = vim.loop
---@tag telescope.actions.history
---@config { ["module"] = "telescope.actions.history" }
---@brief [[
--- A base implementation of a prompt history that provides a simple history
--- and can be replaced with a custom implementation.
@@ -22,7 +25,6 @@ local uv = vim.loop
---
--- See github.com/nvim-telescope/telescope-smart-history.nvim
---@brief ]]
---@tag telescope.actions.history
-- TODO(conni2461): currently not present in plenary path only sync.
-- But sync is just unnecessary here

View File

@@ -1,7 +1,5 @@
---@tag telescope.actions
-- TODO: Add @module to make it so we can have the prefix.
--@module telescope.actions
---@config { ["module"] = "telescope.actions" }
---@brief [[
--- Actions functions that are useful for people creating their own mappings.
@@ -12,41 +10,39 @@
--- (1) The `prompt_bufnr` of a normal function denotes the identifier of your
--- picker which can be used to access the picker state. In practice, users
--- most commonly access from both picker and global state via the following:
---
--- <code>
--- -- for utility functions
--- local action_state = require "telescope.actions.state"
--- -- for utility functions
--- local action_state = require "telescope.actions.state"
---
--- local actions = {}
--- actions.do_stuff = function(prompt_bufnr)
--- local current_picker = action_state.get_current_picker(prompt_bufnr) -- picker state
--- local entry = action_state.get_selected_entry()
--- end
--- local actions = {}
--- actions.do_stuff = function(prompt_bufnr)
--- local current_picker = action_state.get_current_picker(prompt_bufnr) -- picker state
--- local entry = action_state.get_selected_entry()
--- end
--- </code>
---
--- See |telescope.actions.state| for more information.
---
--- (2) To transform a module of functions into a module of "action"s, you need
--- to do the following:
---
--- <code>
--- local transform_mod = require("telescope.actions.mt").transform_mod
--- local transform_mod = require("telescope.actions.mt").transform_mod
---
--- local mod = {}
--- mod.a1 = function(prompt_bufnr)
--- -- your code goes here
--- -- You can access the picker/global state as described above in (1).
--- end
--- local mod = {}
--- mod.a1 = function(prompt_bufnr)
--- -- your code goes here
--- -- You can access the picker/global state as described above in (1).
--- end
---
--- mod.a2 = function(prompt_bufnr)
--- -- your code goes here
--- end
--- mod = transform_mod(mod)
--- mod.a2 = function(prompt_bufnr)
--- -- your code goes here
--- end
--- mod = transform_mod(mod)
---
--- -- Now the following is possible. This means that actions a2 will be executed
--- -- after action a1. You can chain as many actions as you want.
--- local action = mod.a1 + mod.a2
--- action(bufnr)
--- -- Now the following is possible. This means that actions a2 will be executed
--- -- after action a1. You can chain as many actions as you want.
--- local action = mod.a1 + mod.a2
--- action(bufnr)
--- </code>
---
--- Another interesing thing to do is that these actions now have functions you

View File

@@ -1,4 +1,5 @@
---@tag telescope.actions.layout
---@config { ["module"] = "telescope.actions.layout" }
---@brief [[
--- The layout actions are actions to be used to change the layout of a picker.

View File

@@ -1,4 +1,5 @@
---@tag telescope.actions.set
---@config { ["module"] = "telescope.actions.set" }
---@brief [[
--- Telescope action sets are used to provide an interface for managing

View File

@@ -1,4 +1,5 @@
---@tag telescope.actions.state
---@config { ["module"] = "telescope.actions.state" }
---@brief [[
--- Functions to be used to determine the current state of telescope.

View File

@@ -1,4 +1,5 @@
---@tag telescope.actions.utils
---@config { ["module"] = "telescope.actions.utils" }
---@brief [[
--- Utilities to wrap functions around picker selections and entries.