diff options
| author | ThePrimeAgain <theprimeagain@theprimeagain.com> | 2025-11-26 09:38:47 -0700 |
|---|---|---|
| committer | ThePrimeAgain <theprimeagain@theprimeagain.com> | 2025-11-26 09:38:47 -0700 |
| commit | 83b317d6f34cacc5ddc52152ed39e2a4540cb111 (patch) | |
| tree | b1ff49a24a1038ded42c7f311468d61785b4e6a0 | |
| parent | 82b05b232f6a8a2f26432a68759633783efb05ab (diff) | |
| download | a4-83b317d6f34cacc5ddc52152ed39e2a4540cb111.tar.xz a4-83b317d6f34cacc5ddc52152ed39e2a4540cb111.zip | |
feat: fill in function "complete"
| -rw-r--r-- | lua/99/ops/fill-in-function.lua | 2 | ||||
| -rw-r--r-- | lua/99/request/init.lua | 8 | ||||
| -rw-r--r-- | scratch/refresh.lua | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lua/99/ops/fill-in-function.lua b/lua/99/ops/fill-in-function.lua index 45a89b1..3a8edb2 100644 --- a/lua/99/ops/fill-in-function.lua +++ b/lua/99/ops/fill-in-function.lua @@ -11,7 +11,7 @@ local function fill_in_function(_99) md_files = _99.md_files, }) - if !request:has_scopes() then + if not request:has_scopes() then Logger:warn("fill_in_function: unable to find any containing function") error("you cannot call fill_in_function not in a function") end diff --git a/lua/99/request/init.lua b/lua/99/request/init.lua index d020caa..80b98f8 100644 --- a/lua/99/request/init.lua +++ b/lua/99/request/init.lua @@ -45,6 +45,7 @@ function Request.new(opts) local scopes = ts.function_scopes(cursor) local buffer = vim.api.nvim_get_current_buf() + print("request", vim.inspect(cursor), vim.inspect(scopes)) return setmetatable({ cursor = cursor, scopes = scopes, @@ -58,7 +59,7 @@ function Request.new(opts) end function Request:has_scopes() - return self.scopes ~= nil and #self.scopes > 0 + return self.scopes ~= nil and #self.scopes.range > 0 end function Request:get_inner_scope() @@ -107,8 +108,9 @@ function Request:_update_file_with_changes(res) end function Request:start() - Logger:debug("99#make_query", "id", self.id, "query", self.query) - vim.system({ "opencode", "run", "-m", "anthropic/claude-sonnet-4-5", self.query }, { + local query = self.system_prompt + Logger:debug("99#make_query", "id", self.id, "query", query) + vim.system({ "opencode", "run", "-m", "anthropic/claude-sonnet-4-5", query }, { text = true, stdout = vim.schedule_wrap(function(err, data) Logger:debug("STDOUT#data", "id", self.id, "data", data) diff --git a/scratch/refresh.lua b/scratch/refresh.lua new file mode 100644 index 0000000..5119de4 --- /dev/null +++ b/scratch/refresh.lua @@ -0,0 +1,6 @@ +R("99") + + +function return_42() + +end |
