Skip to content

Commit 8c9d932

Browse files
committed
Add replaceable symbols string when none found
1 parent b5322fa commit 8c9d932

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/cwhy/clangd_lsp_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,4 @@ def source_for_symbol(filename: str, symbol: str) -> str:
294294
content = llm_utils.number_group_of_lines(lines, first)
295295
return f"""File '{path}':\n```\n{content}\n```"""
296296

297-
return f"Symbol '{symbol}' not found."
297+
return f"Symbol '{symbol}' is not replaceable.\n" + document_symbols(filename)

test/test_cland_integration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ def test_no_symbol_found(self):
1515
result = clangd_lsp_integration.source_for_symbol(
1616
os.path.join(CPP_TEST_ROOT, "missing-hash.cpp"), "random_symbol_name"
1717
)
18-
self.assertEqual(result, "Symbol 'random_symbol_name' not found.")
18+
self.assertEqual(
19+
result,
20+
"Symbol 'random_symbol_name' is not replaceable.\n"
21+
"Replaceable symbols for 'tests/c++/missing-hash.cpp':\n"
22+
" - Node (Class)\n"
23+
" - bfs (Function)",
24+
)
1925

2026
def test_list_symbols(self):
2127
self.assertTrue(clangd_lsp_integration.is_available())

0 commit comments

Comments
 (0)