Docstrings, minor fixes [ci skip]

This commit is contained in:
Michael Panchenko authored and Dominik Jain committed 2025-12-24 14:55:37 +01:00
1 parent 025ef32220
commit 5801982113
3 files changed
+4 -14

No files matched your search

+2 -3
View File
@@ -174,13 +174,12 @@ class JetBrainsPluginClient(ToStringMixin):
request_data = {"namePath": name_path, "relativePath": relative_path}
return self._make_request("POST", "/findReferences", request_data)
def get_symbols_overview(self, relative_path: str, depth: int, exclude_imports: bool = True) -> dict[str, Any]:
def get_symbols_overview(self, relative_path: str, depth: int) -> dict[str, Any]:
"""
:param relative_path: the relative path to a source file
:param depth: the depth of children to include (0 = no children)
:param exclude_imports: whether to exclude import statements from the overview
"""
request_data = {"relativePath": relative_path, "depth": depth, "excludeImports": exclude_imports}
request_data = {"relativePath": relative_path, "depth": depth}
return self._make_request("POST", "/getSymbolsOverview", request_data)
def rename_symbol(
+1 -1
View File
@@ -147,7 +147,7 @@ class JetBrainsGetSymbolsOverviewTool(Tool, ToolMarkerSymbolicRead, ToolMarkerOp
:param depth: depth up to which descendants shall be retrieved (e.g., use 1 to also retrieve immediate children).
:param max_answer_chars: max characters for the JSON result. If exceeded, no content is returned.
-1 means the default value from the config will be used.
:return: a JSON object containing the symbols
:return: a JSON object containing the symbols grouped by kind in a compact format.
"""
with JetBrainsPluginClient.from_project(self.project) as client:
response_dict = client.get_symbols_overview(relative_path=relative_path, depth=depth)
+1 -10
View File
@@ -3,12 +3,11 @@ Language server-related tools
"""
import os
from collections import defaultdict
from collections.abc import Sequence
from copy import copy
from typing import Any
from black.trans import defaultdict
from serena.tools import (
SUCCESS_RESULT,
Tool,
@@ -64,14 +63,6 @@ class GetSymbolsOverviewTool(Tool, ToolMarkerSymbolicRead):
no content will be returned. -1 means the default value from the config will be used.
Don't adjust unless there is really no other way to get the content required for the task.
:return: a JSON object containing symbols grouped by kind in a compact format.
For depth=0, the structure is: {"Kind1": ["name1", "name2"], "Kind2": ["name3"]}
For depth>0, symbols with children use nested dicts: {"Class": [{"ClassName": {"Method": ["method1", "method2"]}}]}
The name_path for any symbol can be inferred from the structure:
- Top-level symbols: name_path = name
- Nested symbols: name_path = parent_name + "/" + name
Example: "method1" under class "ClassName" has name_path "ClassName/method1"
"""
symbol_retriever = self.create_language_server_symbol_retriever()
file_path = os.path.join(self.project.project_root, relative_path)