From 36bbf879b5c9125be6549af3a7916561048f3dd0 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 19 May 2023 06:38:19 -0700 Subject: [PATCH] tabbed for brevity --- aider/ctags.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/aider/ctags.py b/aider/ctags.py index a4d849887..51ced3a9f 100644 --- a/aider/ctags.py +++ b/aider/ctags.py @@ -3,14 +3,36 @@ import sys def print_tags_info(filename): + last = None + tags = sorted(get_tags(filename)) + + for tag in tags: + if last is None: + show = tag + else: + show = [] + for lst, tg in zip(last, tag): + if lst == tg: + show.append("") + else: + show.append(tg) + + if not show[-1]: + show = show[:-1] + show = "\t".join(show) + print(show) + last = tag + + +def get_tags(filename): with open(filename, "r") as tags_file: for line in tags_file: tag = json.loads(line) - scope = tag.get("scope", "") + scope = tag.get("scope", "(top)") kind = tag.get("kind", "") name = tag.get("name", "") signature = tag.get("signature", "") - print(scope, kind, name, signature) + yield (scope, kind, name, signature) if __name__ == "__main__":