aider-chat: fix tree-sitter query

This commit is contained in:
Zexin Yuan
2025-07-17 12:16:39 +08:00
parent 6c6254bd01
commit c25bc14f67
2 changed files with 23 additions and 2 deletions
@@ -0,0 +1,21 @@
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
View File
@@ -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