summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorfdschmidt93 <39233597+fdschmidt93@users.noreply.github.com>2021-09-09 22:13:16 +0200
committerGitHub <noreply@github.com>2021-09-09 22:13:16 +0200
commit55ec6c5c9c6d70219334c62b1fee4a73bb80cb6f (patch)
tree76ae4f2f793f76d874b79820553c18d8d2385da0 /lua
parent0cb1026b9e051b47d8b6e00277094c815384b8d0 (diff)
fix: restoring picker table/function opts (#1205)
* fix: missing opts for cached picker creation * fix: make properly overridable
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/pickers.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 42e37d9..1c0ce67 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -84,9 +84,8 @@ function Picker:new(opts)
cwd = opts.cwd,
_find_id = 0,
- _completion_callbacks = {},
- manager = (type(opts.manager) == "table" and getmetatable(opts.manger) == getmetatable(EntryManager))
- and opts.manager,
+ _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(),
@@ -97,6 +96,7 @@ function Picker:new(opts)
attach_mappings = opts.attach_mappings,
file_ignore_patterns = get_default(opts.file_ignore_patterns, config.values.file_ignore_patterns),
+ scroll_strategy = get_default(opts.scroll_strategy, config.values.scroll_strategy),
sorting_strategy = get_default(opts.sorting_strategy, config.values.sorting_strategy),
selection_strategy = get_default(opts.selection_strategy, config.values.selection_strategy),
@@ -104,9 +104,15 @@ function Picker:new(opts)
layout_config = config.smarter_depth_2_extend(opts.layout_config or {}, config.values.layout_config or {}),
window = {
- winblend = get_default(opts.winblend, config.values.winblend),
- border = get_default(opts.border, config.values.border),
- borderchars = get_default(opts.borderchars, config.values.borderchars),
+ winblend = get_default(
+ opts.winblend,
+ type(opts.window) == "table" and opts.window.winblend or config.values.winblend
+ ),
+ border = get_default(opts.border, type(opts.window) == "table" and opts.window.border or config.values.border),
+ borderchars = get_default(
+ 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)),
@@ -124,10 +130,7 @@ function Picker:new(opts)
end
-- TODO: It's annoying that this is create and everything else is "new"
- obj.scroller = p_scroller.create(
- get_default(opts.scroll_strategy, config.values.scroll_strategy),
- obj.sorting_strategy
- )
+ obj.scroller = p_scroller.create(obj.scroll_strategy, obj.sorting_strategy)
obj.highlighter = p_highlighter.new(obj)