diff options
| author | theprimeagain <the.primeagen@gmail.com> | 2026-03-01 08:20:58 -0700 |
|---|---|---|
| committer | theprimeagain <the.primeagen@gmail.com> | 2026-03-01 08:20:58 -0700 |
| commit | 0da5086983c2351f8178258a09807ba8fd5ab4e8 (patch) | |
| tree | 25d4b33dd0a30c7b4bb691a303761a17095af222 /lua/99/ops/clean-up.lua | |
| parent | 418ad358128134882bfcc2f40dde16d34cd9c415 (diff) | |
| download | a4-0da5086983c2351f8178258a09807ba8fd5ab4e8.tar.xz a4-0da5086983c2351f8178258a09807ba8fd5ab4e8.zip | |
ensuring state is kept between changes
Diffstat (limited to 'lua/99/ops/clean-up.lua')
| -rw-r--r-- | lua/99/ops/clean-up.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lua/99/ops/clean-up.lua b/lua/99/ops/clean-up.lua index 56a7e11..9eea6da 100644 --- a/lua/99/ops/clean-up.lua +++ b/lua/99/ops/clean-up.lua @@ -7,10 +7,10 @@ local M = {} --- @field on_stderr? fun(line: string): nil --- @field on_start? fun(): nil ---- @param clean_up fun(): nil +--- @param context _99.Prompt --- @param obs_or_fn _99.Providers.PartialObserver | _99.Providers.on_complete --- @return _99.Providers.Observer -M.make_observer = function(clean_up, obs_or_fn) +M.make_observer = function(context, obs_or_fn) --- @type _99.Providers.PartialObserver local obs = type(obs_or_fn) == "table" and obs_or_fn or { @@ -23,8 +23,11 @@ M.make_observer = function(clean_up, obs_or_fn) end end, on_complete = function(status, res) - vim.schedule(clean_up) - obs.on_complete(status, res) + pcall(obs.on_complete, status, res) + vim.schedule(function() + context:stop() + context._99:sync() + end) end, on_stderr = function(line) if obs.on_stderr then |
