@@ -259,6 +259,8 @@ def _analyze_code_file(self, repo_dir: str, file_info: dict):
259259 self ._analyze_ruby_file (file_path , content , repo_dir )
260260 elif language == "scala" :
261261 self ._analyze_scala_file (file_path , content , repo_dir )
262+ elif language == "rust" :
263+ self ._analyze_rust_file (file_path , content , repo_dir )
262264 # else:
263265 # logger.warning(
264266 # f"Unsupported language for call graph analysis: {language} for file {file_path}"
@@ -536,6 +538,28 @@ def _analyze_scala_file(self, file_path: str, content: str, repo_dir: str):
536538 except Exception :
537539 logger .exception (f"Failed to analyze Scala file { file_path } " )
538540
541+ def _analyze_rust_file (self , file_path : str , content : str , repo_dir : str ):
542+ """
543+ Analyze Rust file using tree-sitter based analyzer.
544+
545+ Args:
546+ file_path: Relative path to the Rust file
547+ content: File content string
548+ repo_dir: Repository base directory
549+ """
550+ from codewiki .src .be .dependency_analyzer .analyzers .rust import analyze_rust_file
551+
552+ try :
553+ functions , relationships = analyze_rust_file (file_path , content , repo_path = repo_dir )
554+
555+ for func in functions :
556+ func_id = func .id if func .id else f"{ file_path } :{ func .name } "
557+ self .functions [func_id ] = func
558+
559+ self .call_relationships .extend (relationships )
560+ except Exception :
561+ logger .exception (f"Failed to analyze Rust file { file_path } " )
562+
539563 def _resolve_call_relationships (self ):
540564 """
541565 Resolve function call relationships across all languages.
@@ -834,6 +858,8 @@ def _generate_visualization_data(self) -> dict:
834858 node_classes .append ("lang-ruby" )
835859 elif file_ext in [".scala" , ".sc" ]:
836860 node_classes .append ("lang-scala" )
861+ elif file_ext == ".rs" :
862+ node_classes .append ("lang-rust" )
837863
838864 cytoscape_elements .append (
839865 {
0 commit comments