aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/data.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-21 12:09:59 +0200
committerGitHub <noreply@github.com>2022-04-21 12:09:59 +0200
commitb68fcc6bb2c770495ff8e2508c06dfdd49abcc80 (patch)
treedf7c71efb59958deb21a18eeccf3e3c43c4cd704 /lua/nvim-lsp-installer/data.lua
parentrun autogen_metadata.lua (diff)
downloadmason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.gz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.bz2
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.lz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.xz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.zst
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.zip
chore: refactor remaining installers to async impl (#616)
Diffstat (limited to 'lua/nvim-lsp-installer/data.lua')
-rw-r--r--lua/nvim-lsp-installer/data.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/lua/nvim-lsp-installer/data.lua b/lua/nvim-lsp-installer/data.lua
index 3c736c76..264fda80 100644
--- a/lua/nvim-lsp-installer/data.lua
+++ b/lua/nvim-lsp-installer/data.lua
@@ -69,7 +69,7 @@ function Data.when(condition, value)
return condition and value or nil
end
-function Data.lazy(condition, fn)
+function Data.lazy_when(condition, fn)
return condition and fn() or nil
end
@@ -140,4 +140,14 @@ function Data.memoize(fn, cache_key_generator)
end
end
+function Data.lazy(fn)
+ local ret_val
+ return function()
+ if not ret_val then
+ ret_val = Data.table_pack(fn())
+ end
+ return unpack(ret_val, 1, ret_val.n)
+ end
+end
+
return Data