1 //! Completion for visibility specifiers.
4 context::{CompletionContext, PathCompletionCtx, Qualified},
8 pub(crate) fn complete_vis_path(
10 ctx: &CompletionContext<'_>,
11 path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx,
16 resolution: Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))),
20 // Try completing next child module of the path that is still a parent of the current module
21 let next_towards_current =
22 ctx.module.path_to_root(ctx.db).into_iter().take_while(|it| it != module).last();
23 if let Some(next) = next_towards_current {
24 if let Some(name) = next.name(ctx.db) {
25 cov_mark::hit!(visibility_qualified);
26 acc.add_module(ctx, path_ctx, next, name);
30 acc.add_super_keyword(ctx, *super_chain_len);
32 Qualified::Absolute | Qualified::TypeAnchor { .. } | Qualified::With { .. } => {}
35 cov_mark::hit!(kw_completion_in);
36 acc.add_keyword(ctx, "in");
38 acc.add_nameref_keywords(ctx);