mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 16:15:29 +00:00
Minor: rename .._for_symbols to ..for_symbol_batch
This commit is contained in:
1 parent
f19f2937f7
commit
1377acf6cf
3 files changed
+9
-9
No files matched your search
@@ -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]:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user