Closed mrtnvgr closed 1 year ago
What are you trying to accomplish? You cannot open more than one selection at a time because there is no way for the user to interact with more than one window at a time. If you need to perform multiple selections, you'll need to do that in sequence.
vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice)
vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice)
vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice) end)
end)
end)
What are you trying to accomplish? You cannot open more than one selection at a time because there is no way for the user to interact with more than one window at a time. If you need to perform multiple selections, you'll need to do that in sequence.
vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice) vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice) vim.ui.select({ "Yes", "No" }, { prompt = "1" }, function(choice) end) end) end)
Yes, that's what I need! Is there a way doing this without nested functions? Ideally I would want to call them in a for loop.
for _, name in ipairs(names) do
vim.ui.select({ "Yes", "No" }, { prompt = "Do you want to enable " .. name .. "?" }, function(choice) ... end)
end
If you want to call async functions as though they were synchronous, you'll need to use lua's coroutines. It's possible to use raw coroutines for this, but it would probably be easier to use an async lib. The most popular one I know of is plenary.async, but there are others out there.
If you want to call async functions as though they were synchronous, you'll need to use lua's coroutines. It's possible to use raw coroutines for this, but it would probably be easier to use an async lib. The most popular one I know of is plenary.async, but there are others out there.
Thank you so much! I will try it
Describe the bug When I try to open multiple windows at once, I get this error. How can I spawn multiple selection windows?
System information
vim.ui.select
backend.To Reproduce
Additional context