Added symbol info by default in LS based FindReferencingSymbolsTool

Previously we extracted a few content lines around the symbol instead
This commit is contained in:
Michael Panchenko committed 2026-01-03 19:13:38 +07:00
1 parent 1d5cf33237
commit d3f3326011
2 files changed
+6

No files matched your search

+1
View File
@@ -92,6 +92,7 @@ class JetBrainsFindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead, ToolMark
Finds symbols that reference the given symbol using the JetBrains backend
"""
# TODO: (maybe) - add content snippets showing the references like in LS based version?
def apply(
self,
name_path: str,
+5
View File
@@ -197,6 +197,7 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead):
self,
name_path: str,
relative_path: str,
include_info: bool = True,
include_kinds: list[int] = [], # noqa: B006
exclude_kinds: list[int] = [], # noqa: B006
max_answer_chars: int = -1,
@@ -208,6 +209,8 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead):
:param name_path: for finding the symbol to find references for, same logic as in the `find_symbol` tool.
:param relative_path: the relative path to the file containing the symbol for which to find references.
Note that here you can't pass a directory but must pass a file.
:param include_info: whether to include additional info (hover-like, typically including docstring and signature),
about the referencing symbols. Default True.
:param include_kinds: same as in the `find_symbol` tool.
:param exclude_kinds: same as in the `find_symbol` tool.
:param max_answer_chars: same as in the `find_symbol` tool.
@@ -231,6 +234,8 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead):
if not include_body:
ref_relative_path = ref.symbol.location.relative_path
assert ref_relative_path is not None, f"Referencing symbol {ref.symbol.name} has no relative path, this is likely a bug."
if include_info and (referencing_symbol_info := symbol_retriever.request_info_for_symbol(ref.symbol)):
ref_dict["info"] = referencing_symbol_info
content_around_ref = self.project.retrieve_content_around_line(
relative_file_path=ref_relative_path, line=ref.line, context_lines_before=1, context_lines_after=1
)