Skip to content

Commit 96f2380

Browse files
committed
fix: use ipairs when iterating over resolved embeddings
The code was incorrectly iterating directly over the resolved_embeddings array, which can lead to improper iteration in Lua. This commit fixes the issue by properly using ipairs() to ensure sequential iteration over numeric indices.
1 parent 3373b76 commit 96f2380

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/CopilotChat/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ function M.resolve_context(prompt, config)
369369

370370
local ok, resolved_embeddings = pcall(context_value.resolve, context_data.input, state.source or {}, prompt)
371371
if ok then
372-
for _, embedding in resolved_embeddings do
372+
for _, embedding in ipairs(resolved_embeddings) do
373373
if embedding then
374374
embeddings:set(embedding.filename, embedding)
375375
end

0 commit comments

Comments
 (0)