Unverified Commit c25bc14f authored by Zexin Yuan's avatar Zexin Yuan
Browse files

aider-chat: fix tree-sitter query

parent 6c6254bd
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
diff --git a/aider/repomap.py b/aider/repomap.py
index 23eee239..0a40f2e6 100644
--- a/aider/repomap.py
+++ b/aider/repomap.py
@@ -16,6 +16,7 @@ from grep_ast import TreeContext, filename_to_lang
 from pygments.lexers import guess_lexer_for_filename
 from pygments.token import Token
 from tqdm import tqdm
+from tree_sitter import QueryCursor
 
 from aider.dump import dump
 from aider.special import filter_important_files
@@ -286,7 +287,7 @@ class RepoMap:
 
         # Run the tags queries
         query = language.query(query_scm)
-        captures = query.captures(tree.root_node)
+        captures = QueryCursor(query).captures(tree.root_node)
 
         saw = set()
         if USING_TSL_PACK:
+2 −2
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ let
    ];

    patches = [
      ./fix-tree-sitter.patch

      (replaceVars ./fix-flake8-invoke.patch {
        flake8 = lib.getExe python3Packages.flake8;
      })
@@ -154,7 +156,6 @@ let
    disabledTestPaths = [
      # Tests require network access
      "tests/scrape/test_scrape.py"
      "tests/basic/test_repomap.py"
      # Expected 'mock' to have been called once
      "tests/help/test_help.py"
    ];
@@ -164,7 +165,6 @@ let
        # Tests require network
        "test_urls"
        "test_get_commit_message_with_custom_prompt"
        "test_cmd_tokens_output"
        # FileNotFoundError
        "test_get_commit_message"
        # Expected 'launch_gui' to have been called once