mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 20:17:42 +00:00
Add JetBrainsFindImplementationsTool
This commit is contained in:
1 parent
6ef9158ff5
commit
213086b162
2 files changed
+39
No files matched your search
@@ -610,6 +610,23 @@ class JetBrainsPluginClient(ToStringMixin):
|
||||
self._postprocess_symbol_collection_response(symbol_collection)
|
||||
return symbol_collection
|
||||
|
||||
def find_implementations(self, relative_path: str, name_path: str, include_quick_info: bool) -> jb.SymbolCollectionResponse:
|
||||
"""
|
||||
Finds the implementations of a symbol.
|
||||
|
||||
:param relative_path: the relative path to the file containing the symbol
|
||||
:param name_path: the name path of the symbol
|
||||
:param include_quick_info: whether to include quick info about the symbol
|
||||
"""
|
||||
request_data = {
|
||||
"relativePath": relative_path,
|
||||
"namePath": name_path,
|
||||
"includeQuickInfo": include_quick_info,
|
||||
}
|
||||
symbol_collection = cast(jb.SymbolCollectionResponse, self._make_request("POST", "/findImplementations", request_data))
|
||||
self._postprocess_symbol_collection_response(symbol_collection)
|
||||
return symbol_collection
|
||||
|
||||
def close(self) -> None:
|
||||
self._session.close()
|
||||
|
||||
|
||||
@@ -446,3 +446,25 @@ class JetBrainsFindDeclarationTool(Tool, ToolMarkerSymbolicRead):
|
||||
)
|
||||
result = self._to_json(symbol_collection)
|
||||
return result
|
||||
|
||||
|
||||
class JetBrainsFindImplementationsTool(Tool, ToolMarkerSymbolicRead):
|
||||
"""
|
||||
Finds the implementations of a symbol using the JetBrains backend
|
||||
"""
|
||||
|
||||
def apply(self, relative_path: str, name_path: str) -> str:
|
||||
"""
|
||||
Finds the implementations of a symbol.
|
||||
|
||||
:param relative_path: the relative path to the source file containing the symbol for which to find implementations.
|
||||
:param name_path: name path of the symbol for which to find implementations
|
||||
"""
|
||||
with JetBrainsPluginClient.from_project(self.project) as client:
|
||||
symbol_collection = client.find_implementations(
|
||||
relative_path=relative_path,
|
||||
name_path=name_path,
|
||||
include_quick_info=False,
|
||||
)
|
||||
result = self._to_json(symbol_collection)
|
||||
return result
|
||||
Reference in new issue
Block a user