diff --git a/docs/picker.md b/docs/picker.md index e4609d3e..882d5e05 100644 --- a/docs/picker.md +++ b/docs/picker.md @@ -149,7 +149,11 @@ Snacks.picker.pick({source = "files", ...}) }, file = { filename_first = false, -- display filename before the file path - truncate = 40, -- truncate the file path to (roughly) this length + --- * left: truncate the beginning of the path + --- * center: truncate the middle of the path + --- * right: truncate the end of the path + ---@type "left"|"center"|"right" + truncate = "center", filename_only = false, -- only show the filename icon_width = 2, -- width of the icon (in characters) git_status_hl = true, -- use the git status highlight group for the filename @@ -621,8 +625,17 @@ Snacks.picker.pick({source = "files", ...}) ``` ```lua +---@class snacks.picker.format.ctx +---@field picker snacks.Picker +---@field item snacks.picker.Item +---@field offset number +---@field max_width number +``` + +```lua +---@alias snacks.picker.format.resolve fun(ctx:snacks.picker.format.ctx):snacks.picker.Highlight[] ---@alias snacks.picker.Extmark vim.api.keyset.set_extmark|{col:number, row?:number, field?:string} ----@alias snacks.picker.Text {[1]:string, [2]:string?, virtual?:boolean, field?:string} +---@alias snacks.picker.Text {[1]:string, [2]:string?, virtual?:boolean, field?:string, resolve?:snacks.picker.format.resolve} ---@alias snacks.picker.Highlight snacks.picker.Text|snacks.picker.Extmark ---@alias snacks.picker.format fun(item:snacks.picker.Item, picker:snacks.Picker):snacks.picker.Highlight[] ---@alias snacks.picker.preview fun(ctx: snacks.picker.preview.ctx):boolean?