2022-06-03 15:41:51 +02:00
|
|
|
//! 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,
|
2022-06-03 15:41:51 +02:00
|
|
|
};
|
|
|
|
|
2022-06-17 23:36:39 +02:00
|
|
|
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-17 23:36:39 +02:00
|
|
|
) {
|
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-03 15:41:51 +02:00
|
|
|
..
|
2022-06-17 23:36:39 +02:00
|
|
|
} => {
|
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-06-03 15:41:51 +02:00
|
|
|
}
|
2022-06-17 23:36:39 +02:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 15:06:15 +02:00
|
|
|
pub(crate) fn complete_field_list_record_variant(
|
|
|
|
acc: &mut Completions,
|
|
|
|
ctx: &CompletionContext<'_>,
|
|
|
|
) {
|
2022-06-20 13:17:30 +02:00
|
|
|
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");
|
2022-06-03 15:41:51 +02:00
|
|
|
}
|
|
|
|
}
|