Skip to content

Commit acf547e

Browse files
authored
fix: prevent agent service not initialized error (zbirenbaum#380)
fixes zbirenbaum#321
1 parent 71eeb95 commit acf547e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lua/copilot/client.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local M = {
1212
node_version = nil,
1313
node_version_error = nil,
1414
startup_error = nil,
15+
initialized = false,
1516
}
1617

1718
---@param id number
@@ -217,6 +218,7 @@ local function prepare_client_config(overrides)
217218
vim.notify(string.format("[copilot] setEditorInfo failure: %s", err), vim.log.levels.ERROR)
218219
end
219220
end)
221+
M.initialized = true
220222
end)
221223
end,
222224
on_exit = function(code, _signal, client_id)

lua/copilot/suggestion.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ local function advance(count, ctx)
402402
end
403403

404404
local function schedule(ctx)
405-
if not is_enabled() then
405+
if not is_enabled() or not c.initialized then
406406
clear()
407407
return
408408
end

0 commit comments

Comments
 (0)