chore(docs): Improve docs

This commit is contained in:
Myzel394 2024-04-11 22:35:19 +02:00
parent 5aadc49372
commit 8d7bf6e2fe
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185

View File

@ -1,18 +1,18 @@
--- Type definitions --- Type definitions
---@class Options ---@class Options
---@field key_max_length number ---@field key_max_length number - Length for the key column, 0 for no column-like display, Default: 50
---@field max_length number ---@field max_length number - Maximum length for the value column, Default: 9999 (basically no limit)
---@field overflow_marker string ---@field overflow_marker string - Marker for truncated values, Default: "…"
---@field conceal boolean|"auto" ---@field conceal boolean|"auto" - Whether to conceal strings, If `true` strings will be concealed, If `false` strings will be displayed as they are, If `"auto"` strings will be concealed if `conceallevel` is greater than 0, Default: "auto"
---@field prompt_title string ---@field prompt_title string - Title for the prompt, Default: "JSON(fly)"
---@field highlights Highlights ---@field highlights Highlights - Highlight groups for different types
--- ---
---@class Highlights ---@class Highlights
---@field number string ---@field number string - Highlight group for numbers, Default: "@number.json"
---@field boolean string ---@field boolean string - Highlight group for booleans, Default: "@boolean.json"
---@field string string ---@field string string - Highlight group for strings, Default: "@string.json"
---@field null string ---@field null string - Highlight group for null values, Default: "@constant.builtin.json"
---@field other string ---@field other string - Highlight group for other types, Default: "@label.json"
local json = require"jsonfly.json" local json = require"jsonfly.json"
local finders = require "telescope.finders" local finders = require "telescope.finders"
@ -89,6 +89,7 @@ return require"telescope".register_extension {
---@param opts Options ---@param opts Options
jsonfly = function(opts) jsonfly = function(opts)
opts = opts or {} opts = opts or {}
opts.prompt_title = opts.prompt_title or "JSON(fly)"
opts.key_max_length = opts.key_max_length or 50 opts.key_max_length = opts.key_max_length or 50
opts.max_length = opts.max_length or 9999 opts.max_length = opts.max_length or 9999
opts.overflow_marker = opts.overflow_marker or "" opts.overflow_marker = opts.overflow_marker or ""
@ -122,7 +123,7 @@ return require"telescope".register_extension {
} }
pickers.new(opts, { pickers.new(opts, {
prompt_title = "colors", prompt_title = opts.prompt_title,
finder = finders.new_table { finder = finders.new_table {
results = keys, results = keys,
entry_maker = function(entry) entry_maker = function(entry)