mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
docs: update
This commit is contained in:
parent
b343744d3a
commit
c71f3c84f4
27 changed files with 44 additions and 290 deletions
|
@ -1,10 +1,12 @@
|
|||
---@private
|
||||
---@class snacks.bigfile
|
||||
local M = {}
|
||||
|
||||
---@class snacks.bigfile.Config
|
||||
local defaults = {
|
||||
notify = true,
|
||||
notify = true, -- show notification when big file detected
|
||||
size = 1.5 * 1024 * 1024, -- 1.5MB
|
||||
-- Enable or disable features when big file detected
|
||||
---@param ctx {buf: number, ft:string}
|
||||
setup = function(ctx)
|
||||
vim.b.minianimate_disable = true
|
||||
|
|
|
@ -5,7 +5,7 @@ function M.extract(lines)
|
|||
local code = table.concat(lines, "\n")
|
||||
local config = code:match("\n(%-%-%- ?@class snacks%.%w+%.Config.-\n})")
|
||||
config = config or code:match("\n(%-%-%- ?@class snacks%.Config.-\n})")
|
||||
local mod = code:match("(%-%-%-.*\n)local M =")
|
||||
local mod ---@type string
|
||||
local comments = {} ---@type string[]
|
||||
local types = {} ---@type string[]
|
||||
|
||||
|
@ -17,7 +17,9 @@ function M.extract(lines)
|
|||
table.insert(comments, line)
|
||||
else
|
||||
local comment = table.concat(comments, "\n")
|
||||
if comment:find("@private") then
|
||||
if line:find("^local M =") then
|
||||
mod = comment
|
||||
elseif comment:find("@private") then
|
||||
else
|
||||
local t, name, args = line:match("^function M([:%.])([%w_%.]+)%((.-)%)")
|
||||
if name and args then
|
||||
|
@ -35,14 +37,17 @@ function M.extract(lines)
|
|||
end
|
||||
end
|
||||
|
||||
local private = mod and mod:find("@private")
|
||||
config = config and config:gsub("local defaults = ", ""):gsub("local config = ", "") or nil
|
||||
|
||||
---@class snacks.docs.Info
|
||||
local ret = {
|
||||
config = config and config:gsub("local defaults = ", ""):gsub("local config = ", "") or nil,
|
||||
config = config,
|
||||
mod = mod,
|
||||
methods = methods,
|
||||
types = types,
|
||||
}
|
||||
return ret
|
||||
return private and { config = config, methods = {}, types = {} } or ret
|
||||
end
|
||||
|
||||
---@param tag string
|
||||
|
@ -105,7 +110,9 @@ function M.render(name, info)
|
|||
end
|
||||
end
|
||||
|
||||
add("## 📦 Module\n")
|
||||
if info.mod or #info.methods > 0 then
|
||||
add("## 📦 Module\n")
|
||||
end
|
||||
|
||||
if info.mod then
|
||||
local mod_lines = vim.split(info.mod, "\n")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---@private
|
||||
---@class snacks.quickfile
|
||||
local M = {}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---@private
|
||||
---@class snacks.statuscolumn
|
||||
---@overload fun(): string
|
||||
local M = setmetatable({}, {
|
||||
|
|
|
@ -13,6 +13,7 @@ local config = Snacks.config.get("words", defaults)
|
|||
local ns = vim.api.nvim_create_namespace("vim_lsp_references")
|
||||
local timer = (vim.uv or vim.loop).new_timer()
|
||||
|
||||
---@private
|
||||
function M.setup()
|
||||
local group = vim.api.nvim_create_augroup("snacks_words", { clear = true })
|
||||
|
||||
|
@ -26,6 +27,7 @@ function M.setup()
|
|||
})
|
||||
end
|
||||
|
||||
---@private
|
||||
function M.update()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
timer:start(config.debounce, 0, function()
|
||||
|
@ -53,6 +55,7 @@ function M.is_enabled(buf)
|
|||
> 0
|
||||
end
|
||||
|
||||
---@private
|
||||
---@return LspWord[] words, number? current
|
||||
function M.get()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue