Skip to content

Commit 391138e

Browse files
committed
Warn outside of handle_package_attach_call()
1 parent 4ea50a3 commit 391138e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

crates/ark/src/lsp/diagnostics.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,9 @@ fn recurse_call(
810810
match fun {
811811
"library" | "require" => {
812812
// Track symbols exported by `library()` or `require()` calls
813-
handle_package_attach_call(node, context)?;
813+
if let Err(err) = handle_package_attach_call(node, context) {
814+
lsp::log_warn!("Can't handle attach call: {err:?}");
815+
}
814816
},
815817
_ => {},
816818
};
@@ -841,13 +843,7 @@ fn handle_package_attach_call(node: Node, context: &mut DiagnosticContext) -> an
841843
let package_name = package_node.get_identifier_or_string_text(context.contents)?;
842844
let attach_pos = node.end_position();
843845

844-
let package = match insert_package_exports(&package_name, attach_pos, context) {
845-
Ok(package) => package,
846-
Err(err) => {
847-
lsp::log_warn!("{err:?}");
848-
return Ok(());
849-
},
850-
};
846+
let package = insert_package_exports(&package_name, attach_pos, context)?;
851847

852848
// Also attach packages from `Depends` field
853849
let mut attach_dependencies = package.description.depends.clone();
@@ -896,9 +892,7 @@ fn handle_package_attach_call(node: Node, context: &mut DiagnosticContext) -> an
896892
attach_dependencies.extend(attach_field.into_iter().map(String::from));
897893

898894
for package_name in attach_dependencies {
899-
if let Err(err) = insert_package_exports(&package_name, attach_pos, context) {
900-
lsp::log_warn!("{err:?}");
901-
}
895+
insert_package_exports(&package_name, attach_pos, context)?;
902896
}
903897

904898
Ok(())

0 commit comments

Comments
 (0)