Skip to content

Commit 323baa2

Browse files
committed
Make it explicit that functions are not handled by collect_symbols()
1 parent 9518e93 commit 323baa2

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

crates/ark/src/lsp/symbols.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,22 @@ fn collect_call_arguments(
295295
continue;
296296
};
297297

298-
// Recurse into arguments. They might be a braced list, another call
299-
// that might contain functions, etc.
300-
collect_symbols(&arg_value, contents, 0, symbols)?;
301-
302-
if arg_value.kind() == "function_definition" {
303-
if let Some(arg_fun) = arg.child_by_field_name("name") {
304-
// If this is a named function, collect it as a method
305-
collect_method(&arg_fun, &arg_value, contents, symbols)?;
306-
} else {
307-
// Otherwise, just recurse into the function
308-
let body = arg_value.child_by_field_name("body").into_result()?;
309-
collect_symbols(&body, contents, 0, symbols)?;
310-
};
298+
match arg_value.kind() {
299+
"function_definition" => {
300+
if let Some(arg_fun) = arg.child_by_field_name("name") {
301+
// If this is a named function, collect it as a method
302+
collect_method(&arg_fun, &arg_value, contents, symbols)?;
303+
} else {
304+
// Otherwise, just recurse into the function
305+
let body = arg_value.child_by_field_name("body").into_result()?;
306+
collect_symbols(&body, contents, 0, symbols)?;
307+
};
308+
},
309+
_ => {
310+
// Recurse into arguments. They might be a braced list, another call
311+
// that might contain functions, etc.
312+
collect_symbols(&arg_value, contents, 0, symbols)?;
313+
},
311314
}
312315
}
313316

0 commit comments

Comments
 (0)