diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2021-04-08 10:35:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-08 10:35:44 -0400 |
| commit | 64e59060b1750d0c86761693b6847c3db07afcd2 (patch) | |
| tree | 13e8c0117cdff926e7bbf107f5496c733329cfb7 /lua/telescope/builtin/files.lua | |
| parent | e5fbe6fe60149af8fdeef0d07cba06c029258ba0 (diff) | |
feat: asyncify pickers - except for live_grep (#709)
* something kind of works already
* yayayayayayayayayayayayayayayayayayayayayayayayayayayayayayayayaya
* use async for everything besides live jobs
* fix: fixup autocmds previewer
* fix: lints for prime
* temp: Add example of how we can think about async sorters
* feat: Allow picker to decide when to cancel
* fix: simplify scoring logic and tests
* fixup: name
* fix: Move back towards more backwards compat methods
* fixup: Remove results from opts
* fixup: remove trailing quote
* fixup: Attempt to clean up some more async items. Next is status
* wip: Add todo for when bfredl implements extmarks over the EOL
* wip
* fixup: got em
* fixup: cleaning
* fixup: docs
Diffstat (limited to 'lua/telescope/builtin/files.lua')
| -rw-r--r-- | lua/telescope/builtin/files.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 24d02a0..23ceaa7 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -211,16 +211,16 @@ end files.file_browser = function(opts) opts = opts or {} + opts.depth = opts.depth or 1 opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd() - - local gen_new_finder = function(path) + opts.new_finder = opts.new_finder or function(path) opts.cwd = path local data = {} scan.scan_dir(path, { hidden = opts.hidden or false, add_dirs = true, - depth = 1, + depth = opts.depth, on_insert = function(entry, typ) table.insert(data, typ == 'directory' and (entry .. os_sep) or entry) end @@ -242,8 +242,8 @@ files.file_browser = function(opts) end pickers.new(opts, { - prompt_title = 'Find Files', - finder = gen_new_finder(opts.cwd), + prompt_title = 'File Browser', + finder = opts.new_finder(opts.cwd), previewer = conf.file_previewer(opts), sorter = conf.file_sorter(opts), attach_mappings = function(prompt_bufnr, map) @@ -253,7 +253,7 @@ files.file_browser = function(opts) local new_cwd = vim.fn.expand(action_state.get_selected_entry().path:sub(1, -2)) local current_picker = action_state.get_current_picker(prompt_bufnr) current_picker.cwd = new_cwd - current_picker:refresh(gen_new_finder(new_cwd), { reset_prompt = true }) + current_picker:refresh(opts.new_finder(new_cwd), { reset_prompt = true }) end) local create_new_file = function() @@ -276,7 +276,7 @@ files.file_browser = function(opts) Path:new(fpath:sub(1, -2)):mkdir({ parents = true }) local new_cwd = vim.fn.expand(fpath) current_picker.cwd = new_cwd - current_picker:refresh(gen_new_finder(new_cwd), { reset_prompt = true }) + current_picker:refresh(opts.new_finder(new_cwd), { reset_prompt = true }) end end |
