feat: allow caching and resuming picker (#1051)

* expose `cache_picker` in telescope.setup to configure caching, see `:h telescope.defaults.cache_picker`
* add builtin.resume and builtin.pickers picker
This commit is contained in:
fdschmidt93
2021-09-01 18:17:18 +02:00
committed by GitHub
parent 67bc1dcdd6
commit 5d37c3ea08
11 changed files with 444 additions and 31 deletions

View File

@@ -662,6 +662,32 @@ function make_entry.gen_from_highlights()
end
end
function make_entry.gen_from_picker(opts)
local displayer = entry_display.create {
separator = " ",
items = {
{ width = 30 },
{ remaining = true },
},
}
local make_display = function(entry)
return displayer {
entry.value.prompt_title,
entry.value.default_text,
}
end
return function(entry)
return {
value = entry,
text = entry.prompt_title,
ordinal = string.format("%s %s", entry.prompt_title, utils.get_default(entry.default_text, "")),
display = make_display,
}
end
end
function make_entry.gen_from_buffer_lines(opts)
local displayer = entry_display.create {
separator = "",