fix: workspace filtering (#150)

* fix: call `finder:start()` separately from finder init

fixes #149

* fix: show filter column for default workspace if enabled
This commit is contained in:
Will Hopkins 2023-10-01 00:20:33 -07:00 committed by GitHub
parent eaaabc90ed
commit 4bdd9bafc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,11 +88,12 @@ function Picker:start(opts)
return self:default_path_display(picker_opts, path)
end,
}, opts or {}) --[[@as FrecencyPickerOptions]]
self.workspace = self:get_workspace(opts.cwd, self.config.initial_workspace_tag)
self.workspace = self:get_workspace(opts.cwd, self.config.initial_workspace_tag or self.config.default_workspace_tag)
log.debug { workspace = self.workspace }
self.state = State.new()
local finder = self:finder(opts, self.workspace, self.config.initial_workspace_tag)
local finder =
self:finder(opts, self.workspace, self.config.initial_workspace_tag or self.config.default_workspace_tag)
local picker = pickers.new(opts, {
prompt_title = "Frecency",
finder = finder,
@ -218,7 +219,12 @@ function Picker:on_input_filter_cb(picker_opts)
end
if self.workspace ~= workspace then
self.workspace = workspace
opts.updated_finder = self:finder(picker_opts, self.workspace, tag or self.config.initial_workspace_tag):start()
opts.updated_finder = self:finder(
picker_opts,
self.workspace,
tag or self.config.initial_workspace_tag or self.config.default_workspace_tag
)
opts.updated_finder:start()
end
return opts
end