Skip to content

Commit 2b10c17

Browse files
author
Ahmad bin Marakkar
authored
Option to suppress completion errors (Exafunction#283)
* feat: added `quiet` option in config to suppress errors * doc: ./lua/codeium/api.lua
1 parent ebed4f7 commit 2b10c17

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lua/codeium/api.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ function Server:new()
376376
other_documents = other_documents,
377377
}, function(body, err)
378378
if err then
379-
if err.status == 503 or err.status == 408 then
380-
-- Service Unavailable or Timeout error
379+
if err.status == 503 or err.status == 408 or config.options.quiet then
380+
-- Service Unavailable or Timeout error or in quiet mode
381381
return complete(false, nil)
382382
end
383383

@@ -402,7 +402,9 @@ function Server:new()
402402

403403
local ok, json = pcall(vim.fn.json_decode, body)
404404
if not ok then
405-
notify.error("completion request failed", "invalid JSON:", json)
405+
if not config.options.quiet then
406+
notify.error("completion request failed", "invalid JSON:", json)
407+
end
406408
return
407409
end
408410

lua/codeium/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function M.defaults()
1414
path = "/",
1515
portal_url = "codeium.com",
1616
},
17+
quiet = false,
1718
enterprise_mode = nil,
1819
detect_proxy = nil,
1920
tools = {},

0 commit comments

Comments
 (0)