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

44 lines
1.2 KiB
Rust
Raw Normal View History

//! Completion of field list position.
use crate::{
2022-06-20 14:23:46 +02:00
context::{PathCompletionCtx, Qualified},
2022-06-03 16:33:37 +02:00
CompletionContext, Completions,
};
pub(crate) fn complete_field_list_tuple_variant(
acc: &mut Completions,
2022-07-20 15:02:08 +02:00
ctx: &CompletionContext<'_>,
2022-06-18 01:15:08 +02:00
path_ctx: &PathCompletionCtx,
) {
2022-06-20 14:23:46 +02:00
if ctx.qualifier_ctx.vis_node.is_some() {
return;
}
2022-06-18 01:15:08 +02:00
match path_ctx {
PathCompletionCtx {
has_macro_bang: false,
qualified: Qualified::No,
parent: None,
has_type_args: false,
..
} => {
2022-06-20 14:23:46 +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");
}
_ => (),
}
}
2022-07-20 15:06:15 +02:00
pub(crate) fn complete_field_list_record_variant(
acc: &mut Completions,
ctx: &CompletionContext<'_>,
) {
if ctx.qualifier_ctx.vis_node.is_none() {
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");
}
}