fix(loader)!: correct arguments passed to select_language

This commit is contained in:
Will Lillis 2025-12-07 04:09:22 -05:00
parent e6bfed33ee
commit bec7c3272b
2 changed files with 28 additions and 13 deletions

View file

@ -1109,7 +1109,7 @@ impl Parse {
let path = Path::new(&path);
let language = loader
.select_language(
path,
Some(path),
current_dir,
self.scope.as_deref(),
lib_info.as_ref(),
@ -1140,7 +1140,12 @@ impl Parse {
let language = if let Some(ref lib_path) = self.lib_path {
&loader
.select_language(lib_path, current_dir, None, lib_info.as_ref())
.select_language(
None,
current_dir,
self.scope.as_deref(),
lib_info.as_ref(),
)
.with_context(|| {
anyhow!(
"Failed to load language for path \"{}\"",
@ -1174,8 +1179,12 @@ impl Parse {
let path = get_tmp_source_file(&contents)?;
let name = "stdin";
let language =
loader.select_language(&path, current_dir, None, lib_info.as_ref())?;
let language = loader.select_language(
None,
current_dir,
self.scope.as_deref(),
lib_info.as_ref(),
)?;
parse::parse_file_at_path(
&mut parser,
@ -1256,7 +1265,7 @@ impl Test {
let lib_info =
get_lib_info(self.lib_path.as_ref(), self.lang_name.as_ref(), current_dir);
&loader
.select_language(lib_path, current_dir, None, lib_info.as_ref())
.select_language(None, current_dir, None, lib_info.as_ref())
.with_context(|| {
anyhow!(
"Failed to load language for path \"{}\"",
@ -1437,7 +1446,7 @@ impl Fuzz {
let lang_name = lib_info.1.to_string();
&(
loader
.select_language(lib_path, current_dir, None, Some(&lib_info))
.select_language(None, current_dir, None, Some(&lib_info))
.with_context(|| {
anyhow!(
"Failed to load language for path \"{}\"",
@ -1505,7 +1514,7 @@ impl Query {
match input {
CliInput::Paths(paths) => {
let language = loader.select_language(
Path::new(&paths[0]),
Some(Path::new(&paths[0])),
current_dir,
self.scope.as_deref(),
lib_info.as_ref(),
@ -1541,7 +1550,7 @@ impl Query {
let languages = loader.languages_at_path(current_dir)?;
let language = if let Some(ref lib_path) = self.lib_path {
&loader
.select_language(lib_path, current_dir, None, lib_info.as_ref())
.select_language(None, current_dir, None, lib_info.as_ref())
.with_context(|| {
anyhow!(
"Failed to load language for path \"{}\"",
@ -1575,7 +1584,7 @@ impl Query {
let path = get_tmp_source_file(&contents)?;
let language =
loader.select_language(&path, current_dir, None, lib_info.as_ref())?;
loader.select_language(None, current_dir, None, lib_info.as_ref())?;
let opts = QueryFileOptions {
ordered_captures: self.captures,
byte_range,