code2prompt icon indicating copy to clipboard operation
code2prompt copied to clipboard

Function headers in source tree.

Open mercurial-moon opened this issue 7 months ago • 2 comments

Hi is it possible to add function headers in the source tree. By function headers i mean only the first line of the function with contains the name, arguments and return type. This will utilize less tokens and help give the LLM an overview of the source code.

mercurial-moon avatar May 18 '25 18:05 mercurial-moon

Aider does this using tree sitter: https://aider.chat/2023/10/22/repomap.html

canadaduane avatar Jun 01 '25 05:06 canadaduane

Hi @mercurial-moon,

This is a really interesting idea and would definitely be valuable. A modular approach might make sense here, since each programming language has its own parsing rules, type systems, and module/import resolution quirks. That said, it’s a challenging problem to solve in a general way.

Tree-sitter seems like a promising foundation for this kind of functionality, since it already provides language-specific parsers. The question then is how best to integrate it into Code2Prompt ? I'm not sure if it would fit as a module inside code2prompt or as another crate.

In any case, I agree it would be awesome !

ODAncona avatar Sep 23 '25 18:09 ODAncona