summaryrefslogtreecommitdiff
path: root/lua/99/ops
diff options
context:
space:
mode:
authortheprimeagain <the.primeagen@gmail.com>2026-02-15 16:00:54 -0700
committertheprimeagain <the.primeagen@gmail.com>2026-02-15 16:00:54 -0700
commita5130c1ec63c4b6bbceedbc61906cd9803bfabf8 (patch)
treea5602ee1d407e40e5af0b486f1f79c04070138d5 /lua/99/ops
parent3ade8bbbbcc4fe80a09f22eb59ce8539e4fe2987 (diff)
downloada4-a5130c1ec63c4b6bbceedbc61906cd9803bfabf8.tar.xz
a4-a5130c1ec63c4b6bbceedbc61906cd9803bfabf8.zip
better entry point. success still needs work
Diffstat (limited to 'lua/99/ops')
-rw-r--r--lua/99/ops/clean-up.lua6
-rw-r--r--lua/99/ops/over-range.lua3
-rw-r--r--lua/99/ops/search.lua4
-rw-r--r--lua/99/ops/tutorial.lua3
4 files changed, 8 insertions, 8 deletions
diff --git a/lua/99/ops/clean-up.lua b/lua/99/ops/clean-up.lua
index 2ac099c..cbf077a 100644
--- a/lua/99/ops/clean-up.lua
+++ b/lua/99/ops/clean-up.lua
@@ -7,27 +7,23 @@ local M = {}
--- @field on_stderr? fun(line: string): nil
--- @field on_start? fun(): nil
---- @param context _99.RequestContext
--- @param clean_up fun(): nil
--- @param obs_or_fn _99.Providers.PartialObserver | _99.Providers.on_complete
--- @return _99.Providers.Observer
-M.make_observer = function(context, clean_up, obs_or_fn)
+M.make_observer = function(clean_up, obs_or_fn)
--- @type _99.Providers.PartialObserver
local obs = type(obs_or_fn) == "table" and obs_or_fn
or {
on_complete = obs_or_fn,
}
-
return {
on_start = function()
- context._99:track_request(context, clean_up)
if obs.on_start then
obs.on_start()
end
end,
on_complete = function(status, res)
vim.schedule(clean_up)
- context._99:finish_request(context, status)
obs.on_complete(status, res)
end,
on_stderr = function(line)
diff --git a/lua/99/ops/over-range.lua b/lua/99/ops/over-range.lua
index a37aaf8..7070857 100644
--- a/lua/99/ops/over-range.lua
+++ b/lua/99/ops/over-range.lua
@@ -52,10 +52,11 @@ local function over_range(context, range, opts)
request:add_prompt_content(prompt)
context:add_references(refs)
+ context:add_clean_up(clean_up)
top_status:start()
bottom_status:start()
- request:start(make_observer(context, clean_up, {
+ request:start(make_observer(clean_up, {
on_complete = function(status, response)
if status == "cancelled" then
logger:debug("request cancelled for visual selection, removing marks")
diff --git a/lua/99/ops/search.lua b/lua/99/ops/search.lua
index cde8f64..44dd29c 100644
--- a/lua/99/ops/search.lua
+++ b/lua/99/ops/search.lua
@@ -75,10 +75,12 @@ local function search(context, opts)
local prompt, refs =
make_prompt(context, context._99.prompts.prompts.semantic_search(), opts)
+
request:add_prompt_content(prompt)
context:add_references(refs)
+ context:add_clean_up(clean_up)
- request:start(make_observer(context, clean_up, function(status, response)
+ request:start(make_observer(clean_up, function(status, response)
if status == "cancelled" then
logger:debug("request cancelled for search")
elseif status == "failed" then
diff --git a/lua/99/ops/tutorial.lua b/lua/99/ops/tutorial.lua
index bba56e6..10d3530 100644
--- a/lua/99/ops/tutorial.lua
+++ b/lua/99/ops/tutorial.lua
@@ -24,8 +24,9 @@ local function tutorial(context, opts)
make_prompt(context, context._99.prompts.prompts.tutorial(), opts)
context:add_references(refs)
request:add_prompt_content(prompt)
+ context:add_clean_up(clean_up)
- request:start(make_observer(context, clean_up, function(status, response)
+ request:start(make_observer(clean_up, function(status, response)
vim.schedule(clean_up)
if status == "cancelled" then
logger:debug("cancelled")