Skip to content

Commit

Permalink
Cache workspace files to speed up previewer
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrajano committed Jun 19, 2024
1 parent 329ee31 commit 4a43590
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/telescope/_extensions/neorg/switch_workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ return function(options)
},
})

local files = {}

pickers
.new(opts, {
prompt_title = "Switch Workspace",
Expand All @@ -58,8 +60,11 @@ return function(options)
table.insert(lines, "Path:")
table.insert(lines, tostring(workspace.path))
table.insert(lines, "Files:")
local files = neorg.modules.get_module("core.dirman").get_norg_files(workspace.name)
for _, file in ipairs(files) do

if not files[workspace.name] then
files[workspace.name] = neorg.modules.get_module("core.dirman").get_norg_files(workspace.name)
end
for _, file in ipairs(files[workspace.name]) do
table.insert(lines, tostring(file))
end
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, true, lines)
Expand Down

0 comments on commit 4a43590

Please sign in to comment.