refactor: Update get_scm_fname to support multiple query subdirectories

This commit is contained in:
Paul Gauthier 2025-02-07 15:23:48 -08:00 committed by Paul Gauthier (aider)
parent 64a8d56725
commit f6a2ec15d7

View file

@ -733,8 +733,19 @@ def get_random_color():
def get_scm_fname(lang):
# Load the tags queries
if USING_TSL_PACK:
subdir = "tree-sitter-language-pack"
# check this subdir first, if file exists, return it otherwise check the other. ai!
else:
subdir = "tree-sitter-languages"
try:
return resources.files(__package__).joinpath("queries", f"tree-sitter-{lang}-tags.scm")
return resources.files(__package__).joinpath(
"queries",
subdir,
f"tree-sitter-{lang}-tags.scm",
)
except KeyError:
return