Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Adds documentation for the option default_text (#2685) #2693

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

philolo1
Copy link
Contributor

@philolo1 philolo1 commented Sep 8, 2023

This commit resolves #2685.

Adds documentation for the option default_text to all functions that include it.

Description

Please include a summary of the change and which issue is fixed. Please also
include relevant motivation and context

Fixes #2685

Type of change

Documentation change

How Has This Been Tested?

TODO

  • Test A
  • Test B

@philolo1 philolo1 marked this pull request as draft September 8, 2023 03:05
This commit resolves nvim-telescope#2685.

Adds documentation for the option default_text to all functions that include
it.
@Conni2461
Copy link
Member

not sure we wanna add this to every block or just add a new section at the top of that file that mentions all common options like default_text or we need to find another way to document common stuff that doesnt make sense as config options

@philolo1
Copy link
Contributor Author

philolo1 commented Sep 8, 2023

@Conni2461 my main use case was that i would like to see the options when running :help telescope.builtin.find_files , so i think the doc/telescope.txt changes are necessary in my opinion, but maybe there is a better way to add them in the init.lua file.

@jamestrew
Copy link
Contributor

my concern with this approach is that just like the default_text, there are maybe a dozen or so other options on the base picker, some better documented than others, that any of the builtin pickers can use that aren't documented under telescope.builtin.*. eg. attach_mappings.

local obj = setmetatable({
prompt_title = vim.F.if_nil(opts.prompt_title, config.values.prompt_title),
results_title = vim.F.if_nil(opts.results_title, config.values.results_title),
-- either whats passed in by the user or whats defined by the previewer
preview_title = opts.preview_title,
prompt_prefix = vim.F.if_nil(opts.prompt_prefix, config.values.prompt_prefix),
wrap_results = vim.F.if_nil(opts.wrap_results, config.values.wrap_results),
selection_caret = vim.F.if_nil(opts.selection_caret, config.values.selection_caret),
entry_prefix = vim.F.if_nil(opts.entry_prefix, config.values.entry_prefix),
multi_icon = vim.F.if_nil(opts.multi_icon, config.values.multi_icon),
initial_mode = vim.F.if_nil(opts.initial_mode, config.values.initial_mode),
_original_mode = vim.api.nvim_get_mode().mode,
debounce = vim.F.if_nil(tonumber(opts.debounce), nil),
_finder_attached = true,
default_text = opts.default_text,
get_status_text = vim.F.if_nil(opts.get_status_text, config.values.get_status_text),
_on_input_filter_cb = opts.on_input_filter_cb or function() end,
finder = assert(opts.finder, "Finder is required."),
sorter = opts.sorter or require("telescope.sorters").empty(),
all_previewers = opts.previewer,
current_previewer_index = opts.current_previewer_index or 1,
default_selection_index = opts.default_selection_index,
get_selection_window = vim.F.if_nil(opts.get_selection_window, config.values.get_selection_window),
cwd = opts.cwd,
_find_id = 0,
_completion_callbacks = type(opts._completion_callbacks) == "table" and opts._completion_callbacks or {},
manager = (type(opts.manager) == "table" and getmetatable(opts.manager) == EntryManager) and opts.manager,
_multi = (type(opts._multi) == "table" and getmetatable(opts._multi) == getmetatable(MultiSelect:new()))
and opts._multi
or MultiSelect:new(),
track = vim.F.if_nil(opts.track, false),
stats = {},
attach_mappings = opts.attach_mappings,
file_ignore_patterns = vim.F.if_nil(opts.file_ignore_patterns, config.values.file_ignore_patterns),
scroll_strategy = vim.F.if_nil(opts.scroll_strategy, config.values.scroll_strategy),
sorting_strategy = vim.F.if_nil(opts.sorting_strategy, config.values.sorting_strategy),
tiebreak = vim.F.if_nil(opts.tiebreak, config.values.tiebreak),
selection_strategy = vim.F.if_nil(opts.selection_strategy, config.values.selection_strategy),
push_cursor_on_edit = vim.F.if_nil(opts.push_cursor_on_edit, false),
push_tagstack_on_edit = vim.F.if_nil(opts.push_tagstack_on_edit, false),
layout_strategy = layout_strategy,
layout_config = config.smarter_depth_2_extend(opts.layout_config or {}, config.values.layout_config or {}),
__cycle_layout_list = vim.F.if_nil(opts.cycle_layout_list, config.values.cycle_layout_list),
window = {
winblend = vim.F.if_nil(
opts.winblend,
type(opts.window) == "table" and opts.window.winblend or config.values.winblend
),
border = vim.F.if_nil(opts.border, type(opts.window) == "table" and opts.window.border or config.values.border),
borderchars = vim.F.if_nil(
opts.borderchars,
type(opts.window) == "table" and opts.window.borderchars or config.values.borderchars
),
},
cache_picker = config.resolve_table_opts(opts.cache_picker, vim.deepcopy(config.values.cache_picker)),
__scrolling_limit = tonumber(vim.F.if_nil(opts.temp__scrolling_limit, 250)),
}, self)

It's tricky finding an appropriate place to document all these options. What I want to avoid is going down the path of listing all options a given picker can use under telescope.builtin.* since that would really dilute the picker specific options.

@Conni2461
Copy link
Member

I rather document them under :help telescope.builtin duplicating those doesn't have any benefit, but we only have to document stuff that isn't already exposed as an actual config option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

default_text option in find_files is not documented
3 participants