Move more things into PathCompletionContext

This commit is contained in:
Lukas Wirth 2021-06-07 12:29:46 +02:00
parent e475bcdcc6
commit 4eabcb2c01
8 changed files with 62 additions and 46 deletions

View file

@ -14,7 +14,7 @@ fn snippet(ctx: &CompletionContext, cap: SnippetCap, label: &str, snippet: &str)
}
pub(crate) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionContext) {
if !(ctx.is_trivial_path && ctx.function_def.is_some()) {
if !(ctx.is_trivial_path() && ctx.function_def.is_some()) {
return;
}
let cap = match ctx.config.snippet_cap {
@ -22,7 +22,7 @@ pub(crate) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
None => return,
};
if ctx.can_be_stmt {
if ctx.can_be_stmt() {
snippet(ctx, cap, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc);
snippet(ctx, cap, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc);
}