Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.2 KiB
Rust
Raw Normal View History

//! Completion of field list position.
use crate::{
2022-06-17 10:45:19 +02:00
context::{
IdentContext, NameContext, NameKind, NameRefContext, NameRefKind, PathCompletionCtx,
PathKind, Qualified, TypeLocation,
2022-06-17 10:45:19 +02:00
},
2022-06-03 16:33:37 +02:00
CompletionContext, Completions,
};
pub(crate) fn complete_field_list(acc: &mut Completions, ctx: &CompletionContext) {
match &ctx.ident_ctx {
IdentContext::Name(NameContext { kind: NameKind::RecordField, .. })
| IdentContext::NameRef(NameRefContext {
2022-06-17 10:45:19 +02:00
kind:
Some(NameRefKind::Path(PathCompletionCtx {
has_macro_bang: false,
qualified: Qualified::No,
parent: None,
kind: PathKind::Type { location: TypeLocation::TupleField },
has_type_args: false,
..
2022-06-17 10:45:19 +02:00
})),
..
}) => {
if ctx.qualifier_ctx.vis_node.is_none() {
2022-06-03 16:33:37 +02:00
let mut add_keyword = |kw, snippet| acc.add_keyword_snippet(ctx, kw, snippet);
add_keyword("pub(crate)", "pub(crate)");
add_keyword("pub(super)", "pub(super)");
add_keyword("pub", "pub");
}
}
_ => return,
}
}