Skip to content

Commit

Permalink
Merge pull request #66 from mtrajano/cache_workspace_files
Browse files Browse the repository at this point in the history
Cache workspace files to speed up switch_workspace previewer
  • Loading branch information
max397574 authored Jun 19, 2024
2 parents 329ee31 + 4a43590 commit aa703f4
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 aa703f4

Please sign in to comment.