From 3261aaacdb8783ff00446229d073b83e2b08660b Mon Sep 17 00:00:00 2001 From: Jonas Widen <jonas.widen@widens.eu> Date: Sun, 16 Mar 2025 21:42:51 +0100 Subject: [PATCH] Added completion --- lua/gemini/completion.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lua/gemini/completion.lua b/lua/gemini/completion.lua index b7cfcee..e7ebc05 100644 --- a/lua/gemini/completion.lua +++ b/lua/gemini/completion.lua @@ -29,10 +29,6 @@ local function show_suggestion(suggestion, start_col) current_suggestion.text = suggestion current_suggestion.start_col = start_col - -- Show suggestion in a different color - vim.api.nvim_buf_add_highlight(0, current_suggestion.namespace_id, 'GeminiSuggestion', line, start_col, start_col + #suggestion) - vim.api.nvim_buf_set_text(0, line, start_col, line, start_col, {suggestion}) - -- Make the text virtual (doesn't affect actual buffer content) vim.api.nvim_buf_set_extmark(0, current_suggestion.namespace_id, line, start_col, { virt_text = {{suggestion, 'GeminiSuggestion'}}, @@ -73,10 +69,7 @@ function M.trigger_completion() -- Get completion from Gemini api.get_response(prompt, nil, function(response, error) - if error then - vim.notify("Completion error: " .. error, vim.log.levels.ERROR) - return - end + if error then return end if type(response) == "string" then -- Get first non-empty line as suggestion @@ -94,7 +87,7 @@ end function M.setup() -- Create highlight group for suggestions vim.api.nvim_set_hl(0, 'GeminiSuggestion', { - fg = '#888888', + fg = '#666666', italic = true, })