diff --git a/src/serena/symbol.py b/src/serena/symbol.py index a946028a..2bc43d8a 100644 --- a/src/serena/symbol.py +++ b/src/serena/symbol.py @@ -552,7 +552,7 @@ class LanguageServerSymbolRetriever: return None return self._request_info(relative_file_path=symbol.relative_path, line=symbol.line, column=symbol.column) # type: ignore[arg-type] - def request_info_for_symbols( + def request_info_for_symbol_batch( self, symbols: list[LanguageServerSymbol], ) -> dict[LanguageServerSymbol, str | None]: diff --git a/src/serena/tools/symbol_tools.py b/src/serena/tools/symbol_tools.py index 4f2b6fcf..2355ae73 100644 --- a/src/serena/tools/symbol_tools.py +++ b/src/serena/tools/symbol_tools.py @@ -187,7 +187,7 @@ class FindSymbolTool(Tool, ToolMarkerSymbolicRead): ) symbol_dicts = [_sanitize_symbol_dict(s.to_dict(kind=True, location=True, depth=depth, include_body=include_body)) for s in symbols] if not include_body and include_info: - info_by_symbol = symbol_retriever.request_info_for_symbols(symbols) + info_by_symbol = symbol_retriever.request_info_for_symbol_batch(symbols) for s, s_dict in zip(symbols, symbol_dicts, strict=True): if symbol_info := info_by_symbol.get(s): s_dict["info"] = symbol_info @@ -241,7 +241,7 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead): info_by_symbol = {} if not include_body and include_info: ref_symbols = [ref.symbol for ref in references_in_symbols] - info_by_symbol = symbol_retriever.request_info_for_symbols(ref_symbols) + info_by_symbol = symbol_retriever.request_info_for_symbol_batch(ref_symbols) reference_dicts = [] for ref in references_in_symbols: diff --git a/test/serena/test_symbol.py b/test/serena/test_symbol.py index 7d8c4cea..865d603a 100644 --- a/test/serena/test_symbol.py +++ b/test/serena/test_symbol.py @@ -281,7 +281,7 @@ class TestHoverBudget: # Create mock symbols with unique (line, col) pairs symbols = _make_mock_symbols(3) - result = symbol_retriever.request_info_for_symbols(symbols) + result = symbol_retriever.request_info_for_symbol_batch(symbols) # All 3 symbols should have info (no budget exceeded) assert call_count == 3 @@ -319,7 +319,7 @@ class TestHoverBudget: # Create 5 mock symbols with unique (line, col) pairs symbols = _make_mock_symbols(5) - result = symbol_retriever.request_info_for_symbols(symbols) + result = symbol_retriever.request_info_for_symbol_batch(symbols) # Budget is 0.1s, each call takes 0.05s, so only 2 calls should succeed # After 2 calls: 0.1s >= 0.1s budget, remaining 3 should be skipped @@ -357,7 +357,7 @@ class TestHoverBudget: # Create mock symbols symbols = _make_mock_symbols(5) - result = symbol_retriever.request_info_for_symbols(symbols) + result = symbol_retriever.request_info_for_symbol_batch(symbols) # All 5 symbols should be looked up (no budget limit) assert call_count == 5 @@ -395,7 +395,7 @@ class TestHoverBudget: # Create 5 mock symbols symbols = _make_mock_symbols(5) - symbol_retriever.request_info_for_symbols(symbols) + symbol_retriever.request_info_for_symbol_batch(symbols) # Project budget is 0.05s, each call takes 0.03s # Budget check happens BEFORE starting a new call: @@ -431,7 +431,7 @@ class TestHoverBudget: # Create 3 mock symbols symbols = _make_mock_symbols(3) - result = symbol_retriever.request_info_for_symbols(symbols) + result = symbol_retriever.request_info_for_symbol_batch(symbols) # Global budget is 10s, all 3 should succeed assert call_count == 3 @@ -456,7 +456,7 @@ class TestHoverBudget: # Create 3 mock symbols symbols = _make_mock_symbols(3) - result = symbol_retriever.request_info_for_symbols(symbols) + result = symbol_retriever.request_info_for_symbol_batch(symbols) # Default budget is 5s, all 3 should succeed assert call_count == 3