Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
paul-gauthier opened this issue Jan 3, 2024 · 7 comments
Open
Labels
bug Something isn't working

Comments

@paul-gauthier
Copy link
Collaborator

paul-gauthier commented Jan 3, 2024

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...

tree-sitter/tree-sitter-typescript#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 paul-gauthier added the bug Something isn't working label Jan 3, 2024
@MindsightsAI
Copy link

$ 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

@paul-gauthier
Copy link
Collaborator Author

@MindsightsAI that issue is fixed. See #362.

@Stan4394
Copy link

Is there a solution for this issue?

@paul-gauthier
Copy link
Collaborator Author

Best thing is to use .aiderignore to ignore problematic files. Or some users report that linting/reformatting the file resolves the issue.

@odinho
Copy link

odinho commented Jan 21, 2025

Any obvious way to figure out what file is actually causing the issue? I've '.aiderignore'd quite a lot of files by now. B-)

@paul-gauthier
Copy link
Collaborator Author

Yes, run with --verbose and see which file it's working on when it hangs.

@paul-gauthier
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants