fix: filter out empty filepath snippets (#1885)

This commit is contained in:
yetone
2025-04-17 00:03:37 +08:00
committed by GitHub
parent 2f2aaee3b4
commit 1eb0fd8253

View File

@@ -696,8 +696,10 @@ local function extract_cursor_planning_code_snippets_map(response_content, curre
local snippets_map = {}
for _, snippet in ipairs(snippets) do
if snippet.filepath == "" then goto continue end
snippets_map[snippet.filepath] = snippets_map[snippet.filepath] or {}
table.insert(snippets_map[snippet.filepath], snippet)
::continue::
end
return snippets_map
@@ -773,8 +775,10 @@ local function extract_code_snippets_map(response_content)
local snippets_map = {}
for _, snippet in ipairs(snippets) do
if snippet.filepath == "" then goto continue end
snippets_map[snippet.filepath] = snippets_map[snippet.filepath] or {}
table.insert(snippets_map[snippet.filepath], snippet)
::continue::
end
return snippets_map