mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
refactor: Improve file lookup logic in get_scm_fname
This commit is contained in:
parent
f6a2ec15d7
commit
5d1f50117b
1 changed files with 12 additions and 4 deletions
|
@ -735,11 +735,19 @@ def get_scm_fname(lang):
|
||||||
# Load the tags queries
|
# Load the tags queries
|
||||||
if USING_TSL_PACK:
|
if USING_TSL_PACK:
|
||||||
subdir = "tree-sitter-language-pack"
|
subdir = "tree-sitter-language-pack"
|
||||||
# check this subdir first, if file exists, return it otherwise check the other. ai!
|
try:
|
||||||
else:
|
path = resources.files(__package__).joinpath(
|
||||||
subdir = "tree-sitter-languages"
|
"queries",
|
||||||
|
subdir,
|
||||||
|
f"tree-sitter-{lang}-tags.scm",
|
||||||
|
)
|
||||||
|
if path.exists():
|
||||||
|
return path
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Fall back to tree-sitter-languages
|
||||||
|
subdir = "tree-sitter-languages"
|
||||||
try:
|
try:
|
||||||
return resources.files(__package__).joinpath(
|
return resources.files(__package__).joinpath(
|
||||||
"queries",
|
"queries",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue