From 28082fae78ebf51bcbd46a9c1c58f2b69cc6922f Mon Sep 17 00:00:00 2001 From: Akanksha Trehun Date: Mon, 9 Feb 2026 16:47:54 +0530 Subject: [PATCH] feat: Add support for .hh C++ header extension - Add .hh extension to parsers dictionary - Add .hh extension to pre_scan_for_imports method The .hh extension is a common C++ header file extension used in many projects, particularly those following modern C++ conventions. Closes #469 --- src/codegraphcontext/tools/graph_builder.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/codegraphcontext/tools/graph_builder.py b/src/codegraphcontext/tools/graph_builder.py index f3d005cc1..61326cbab 100644 --- a/src/codegraphcontext/tools/graph_builder.py +++ b/src/codegraphcontext/tools/graph_builder.py @@ -105,6 +105,7 @@ def __init__(self, db_manager: DatabaseManager, job_manager: JobManager, loop: a '.cpp': TreeSitterParser('cpp'), '.h': TreeSitterParser('cpp'), '.hpp': TreeSitterParser('cpp'), + '.hh': TreeSitterParser('cpp'), '.rs': TreeSitterParser('rust'), '.c': TreeSitterParser('c'), # '.h': TreeSitterParser('c'), # Need to write an algo for distinguishing C vs C++ headers @@ -209,6 +210,9 @@ def _pre_scan_for_imports(self, files: list[Path]) -> dict: if '.hpp' in files_by_lang: from .languages import cpp as cpp_lang_module imports_map.update(cpp_lang_module.pre_scan_cpp(files_by_lang['.hpp'], self.parsers['.hpp'])) + if '.hh' in files_by_lang: + from .languages import cpp as cpp_lang_module + imports_map.update(cpp_lang_module.pre_scan_cpp(files_by_lang['.hh'], self.parsers['.hh'])) if '.rs' in files_by_lang: from .languages import rust as rust_lang_module imports_map.update(rust_lang_module.pre_scan_rust(files_by_lang['.rs'], self.parsers['.rs']))