feat: add loading text for large projects

Large projects can take a long time for the initial scan. This adds some
loading text until the initial selection has completed.

This will also now schedule the work to collect and sort the candidates
to ensure the UI is rendered before with work begins and creates a
hanging user experience.
This commit is contained in:
Ade Attwood 2022-07-23 14:59:51 +01:00
parent 4e174d65f8
commit 8ac1035d8a

View file

@ -11,17 +11,23 @@ controller.run = function(items, callback)
controller.items = items
window.initialize()
window.set_items { "-- Loading ---" }
controller.input ""
end
controller.input = function(char)
prompt.input(char)
window.set_items(controller.items(prompt.text()))
vim.schedule(function()
window.set_items(controller.items(prompt.text()))
end)
end
controller.search = function(value)
prompt.set(value)
window.set_items(controller.items(prompt.text()))
vim.schedule(function()
window.set_items(controller.items(prompt.text()))
end)
end
controller.complete = function()