Added completion

This commit is contained in:
Jonas Widen 2025-03-16 21:33:03 +01:00
parent a91239f4c1
commit a04835f90c

View File

@ -40,7 +40,6 @@ local function parse_completion_response(response)
end
function M.get_completion(params, callback)
vim.notify("Gemini completion triggered", vim.log.levels.INFO)
local cursor = vim.api.nvim_win_get_cursor(0)
local line = cursor[1]
local col = cursor[2]
@ -60,12 +59,9 @@ function M.get_completion(params, callback)
before_cursor
)
vim.notify("Sending completion request to Gemini", vim.log.levels.INFO)
-- Get completion from Gemini
api.get_response(prompt, nil, function(response, error)
if error then
vim.notify("Completion error: " .. error, vim.log.levels.ERROR)
callback({
{
word = "Error: " .. error,
@ -76,7 +72,6 @@ function M.get_completion(params, callback)
return
end
vim.notify("Received completion response", vim.log.levels.INFO)
local items = parse_completion_response(response)
callback(items)
end)