use super::{CompletionContext, Completions};
pub(super) fn complete_unqualified_path(result: &mut Completions, ctx: &CompletionContext) {
if !ctx.is_trivial_path {
return;
}
ctx.scope.visit_all_names(&mut |name, def| {
result.add_resolution(ctx, name.to_string(), &def);
});
}
#[cfg(test)]
mod tests {
use crate::{completion::test_utils::completion_string, completion::CompletionKind};
#[test]
fn test_local_scope() {
insta::assert_snapshot!(completion_string(
r#"
fn foo() {
let bar = 0;
let foo_bar = 0;
f$0
}
"#,
Some(CompletionKind::Reference)
))
}
}