mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
works
This commit is contained in:
parent
b0aa4ef4c8
commit
17993ef9ff
4 changed files with 17 additions and 11 deletions
|
@ -8,7 +8,7 @@ from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from grep_ast import TreeContext, filename_to_lang
|
from grep_ast import TreeContext, filename_to_lang
|
||||||
from tree_sitter_languages import get_parser # noqa: E402
|
from tree_sitter_language_pack import get_parser # noqa: E402
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.run_cmd import run_cmd_subprocess # noqa: F401
|
from aider.run_cmd import run_cmd_subprocess # noqa: F401
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
(comment)* @doc
|
(comment)* @doc
|
||||||
.
|
.
|
||||||
[
|
[
|
||||||
(function
|
(function_expression
|
||||||
name: (identifier) @name.definition.function)
|
name: (identifier) @name.definition.function)
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @name.definition.function)
|
name: (identifier) @name.definition.function)
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
(lexical_declaration
|
(lexical_declaration
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @name.definition.function
|
name: (identifier) @name.definition.function
|
||||||
value: [(arrow_function) (function)]) @definition.function)
|
value: [(arrow_function) (function_expression)]) @definition.function)
|
||||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||||
(#select-adjacent! @doc @definition.function)
|
(#select-adjacent! @doc @definition.function)
|
||||||
)
|
)
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @name.definition.function
|
name: (identifier) @name.definition.function
|
||||||
value: [(arrow_function) (function)]) @definition.function)
|
value: [(arrow_function) (function_expression)]) @definition.function)
|
||||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||||
(#select-adjacent! @doc @definition.function)
|
(#select-adjacent! @doc @definition.function)
|
||||||
)
|
)
|
||||||
|
@ -66,12 +66,12 @@
|
||||||
(member_expression
|
(member_expression
|
||||||
property: (property_identifier) @name.definition.function)
|
property: (property_identifier) @name.definition.function)
|
||||||
]
|
]
|
||||||
right: [(arrow_function) (function)]
|
right: [(arrow_function) (function_expression)]
|
||||||
) @definition.function
|
) @definition.function
|
||||||
|
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @name.definition.function
|
key: (property_identifier) @name.definition.function
|
||||||
value: [(arrow_function) (function)]) @definition.function
|
value: [(arrow_function) (function_expression)]) @definition.function
|
||||||
|
|
||||||
(
|
(
|
||||||
(call_expression
|
(call_expression
|
||||||
|
|
|
@ -11,6 +11,7 @@ from collections import Counter, defaultdict, namedtuple
|
||||||
from importlib import resources
|
from importlib import resources
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import tree_sitter
|
||||||
from diskcache import Cache
|
from diskcache import Cache
|
||||||
from grep_ast import TreeContext, filename_to_lang
|
from grep_ast import TreeContext, filename_to_lang
|
||||||
from pygments.lexers import guess_lexer_for_filename
|
from pygments.lexers import guess_lexer_for_filename
|
||||||
|
@ -279,12 +280,17 @@ class RepoMap:
|
||||||
tree = parser.parse(bytes(code, "utf-8"))
|
tree = parser.parse(bytes(code, "utf-8"))
|
||||||
|
|
||||||
# Run the tags queries
|
# Run the tags queries
|
||||||
query = language.query(query_scm)
|
try:
|
||||||
|
query = language.query(query_scm)
|
||||||
|
except tree_sitter.QueryError as err:
|
||||||
|
dump(fname, err)
|
||||||
|
return
|
||||||
|
|
||||||
captures = query.captures(tree.root_node)
|
captures = query.captures(tree.root_node)
|
||||||
|
|
||||||
dump(fname)
|
# dump(fname)
|
||||||
dump(captures)
|
# dump(captures)
|
||||||
dump(captures.keys())
|
# dump(captures.keys())
|
||||||
|
|
||||||
saw = set()
|
saw = set()
|
||||||
for tag, nodes in captures.items():
|
for tag, nodes in captures.items():
|
||||||
|
|
|
@ -63,7 +63,7 @@ gitdb==4.0.12
|
||||||
# via gitpython
|
# via gitpython
|
||||||
gitpython==3.1.44
|
gitpython==3.1.44
|
||||||
# via -r requirements/requirements.in
|
# via -r requirements/requirements.in
|
||||||
grep-ast==0.5.0
|
#grep-ast==0.5.0
|
||||||
# via -r requirements/requirements.in
|
# via -r requirements/requirements.in
|
||||||
h11==0.14.0
|
h11==0.14.0
|
||||||
# via httpcore
|
# via httpcore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue