Skip to content

Commit aa703f4

Browse files
authored
Merge pull request #66 from mtrajano/cache_workspace_files
Cache workspace files to speed up switch_workspace previewer
2 parents 329ee31 + 4a43590 commit aa703f4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/telescope/_extensions/neorg/switch_workspace.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ return function(options)
3535
},
3636
})
3737

38+
local files = {}
39+
3840
pickers
3941
.new(opts, {
4042
prompt_title = "Switch Workspace",
@@ -58,8 +60,11 @@ return function(options)
5860
table.insert(lines, "Path:")
5961
table.insert(lines, tostring(workspace.path))
6062
table.insert(lines, "Files:")
61-
local files = neorg.modules.get_module("core.dirman").get_norg_files(workspace.name)
62-
for _, file in ipairs(files) do
63+
64+
if not files[workspace.name] then
65+
files[workspace.name] = neorg.modules.get_module("core.dirman").get_norg_files(workspace.name)
66+
end
67+
for _, file in ipairs(files[workspace.name]) do
6368
table.insert(lines, tostring(file))
6469
end
6570
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, true, lines)

0 commit comments

Comments
 (0)