aider icon indicating copy to clipboard operation
aider copied to clipboard

Tree-sitter tsx parser hangs sometimes, causing aider to hang

Open paul-gauthier opened this issue 1 year ago • 2 comments

User reports aider hangs when using a repo full of .tsx files. Using --no-git removes the hang. Issue appears to be in the repo map code.

https://discord.com/channels/1131200896827654144/1192136795077496852

Many reported issues with the tree-sitter tsx parser hanging...

https://github.com/tree-sitter/tree-sitter-typescript/issues/265

Best solution is probably to isolate the parsing so that if it hangs on a single file that doesn't block all the other files in the repo from parsing or hang aider.

paul-gauthier avatar Jan 03 '24 16:01 paul-gauthier

$ aider --model gpt-4-1106-preview --show-repo-map
Aider v0.19.1
VSCode terminal detected, pretty output has been disabled.
Command Line Args:   --model gpt-4-1106-preview --show-repo-map --verbose --openai-api-key ***
Model: gpt-4-1106-preview using udiff edit format
Git repo: .git with 123 files
Repo-map: using 1024 tokens
Traceback (most recent call last):
  File "/home/ahwe/.pyenv/versions/3.10.11/bin/aider", line 8, in <module>
    sys.exit(main())
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/aider/main.py", line 562, in main
    repo_map = coder.get_repo_map()
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/aider/coders/base_coder.py", line 321, in get_repo_map
    repo_content = self.repo_map.get_repo_map(self.abs_fnames, other_files)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/aider/repomap.py", line 63, in get_repo_map
    files_listing = self.get_ranked_tags_map(chat_files, other_files)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/aider/repomap.py", line 338, in get_ranked_tags_map
    tree = self.to_tree(ranked_tags[:middle], chat_rel_fnames)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/aider/repomap.py", line 379, in to_tree
    context = TreeContext(
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/grep_ast/grep_ast.py", line 66, in __init__
    self.walk_tree(root_node)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/grep_ast/grep_ast.py", line 285, in walk_tree
    self.walk_tree(child, depth + 1)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/grep_ast/grep_ast.py", line 285, in walk_tree
    self.walk_tree(child, depth + 1)
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/grep_ast/grep_ast.py", line 285, in walk_tree
    self.walk_tree(child, depth + 1)
  [Previous line repeated 988 more times]
  File "/home/ahwe/.pyenv/versions/3.10.11/lib/python3.10/site-packages/grep_ast/grep_ast.py", line 262, in walk_tree
    self.nodes[start_line].append(node)
RecursionError: maximum recursion depth exceeded while calling a Python object

MindsightsAI avatar Jan 03 '24 18:01 MindsightsAI

@MindsightsAI that issue is fixed. See #362.

paul-gauthier avatar Jan 03 '24 19:01 paul-gauthier