Files
serena/scripts/demo_run_tools.py
T
Michael Panchenko fe6a7d04f4 Major: replace location-based symbol referencing by name_path based
Also:
1. find_references now cannot return bodies, instead content around the reference is included
2. find_reference_snippets tool removed since it's no longer necessary
2025-05-31 14:03:45 +02:00

30 lines
910 B
Python

"""
This script demonstrates how to use Serena's tools locally, useful
for testing or development. Here the tools will be operation the serena repo itself.
"""
from pprint import pprint
from serena.agent import *
from serena.constants import REPO_ROOT
@dataclass
class InMemorySerenaConfig(SerenaConfigBase):
"""
In-memory implementation of Serena configuration with the GUI disabled.
"""
gui_log_window_enabled: bool = False
web_dashboard: bool = False
if __name__ == "__main__":
# project_path = str(Path("test") / "resources" / "repos" / "python" / "test_repo")
agent = SerenaAgent(project=REPO_ROOT)
# apply a tool
find_refs_tool = agent.get_tool(FindReferencingSymbolsTool)
print("Finding the symbol 'SyncLanguageServer'\n")
pprint(json.loads(find_refs_tool.apply(name_path="SyncLanguageServer", relative_file_path="src/multilspy/language_server.py")))