minimal extui fuzzy finder for neovim

feat: use `artio.schedule(f)` api fn

+24 -15
+1 -12
lua/artio/builtins.lua
··· 28 return 29 end 30 31 - local Picker = require("artio.picker") 32 - local current = Picker.active_picker 33 - if not current or not current.closed then 34 - return 35 - end 36 - 37 - vim.schedule(function() 38 - vim.defer_fn(builtins[fname], 10) 39 - vim.wait(1000, function() 40 - return coroutine.status(current.co) == "dead" 41 - end) 42 - end) 43 end, 44 }, props) 45 )
··· 28 return 29 end 30 31 + artio.schedule(builtins[fname]) 32 end, 33 }, props) 34 )
+23 -3
lua/artio/init.lua
··· 132 "force", 133 { 134 on_close = function(_, idx) 135 - return on_choice(items[idx], idx) 136 end, 137 on_quit = function() 138 - return on_choice(nil, nil) 139 end, 140 }, 141 opts or {}, -- opts.prompt, opts.format_item ··· 160 return Picker:new(...):open() 161 end 162 163 ---@param fn artio.Picker.action 164 ---@param scheduled_fn? artio.Picker.action 165 artio.wrap = function(fn, scheduled_fn) ··· 180 if scheduled_fn == nil then 181 return 182 end 183 - vim.schedule(function() 184 pcall(scheduled_fn, current) 185 end) 186 end
··· 132 "force", 133 { 134 on_close = function(_, idx) 135 + artio.schedule(function() 136 + on_choice(items[idx], idx) 137 + end) 138 end, 139 on_quit = function() 140 + artio.schedule(function() 141 + on_choice(nil, nil) 142 + end) 143 end, 144 }, 145 opts or {}, -- opts.prompt, opts.format_item ··· 164 return Picker:new(...):open() 165 end 166 167 + ---@param f fun(): any 168 + artio.schedule = function(f) 169 + local Picker = require("artio.picker") 170 + local current = Picker.active_picker 171 + if not current or not current.closed then 172 + return 173 + end 174 + 175 + vim.schedule(function() 176 + vim.defer_fn(f, 10) 177 + vim.wait(1000, function() 178 + return coroutine.status(current.co) == "dead" 179 + end) 180 + end) 181 + end 182 + 183 ---@param fn artio.Picker.action 184 ---@param scheduled_fn? artio.Picker.action 185 artio.wrap = function(fn, scheduled_fn) ··· 200 if scheduled_fn == nil then 201 return 202 end 203 + artio.schedule(function() 204 pcall(scheduled_fn, current) 205 end) 206 end