This commit is contained in:
Lukas Wirth 2021-08-14 19:06:35 +02:00
parent d7374ab882
commit 2e733b1a3e
5 changed files with 70 additions and 58 deletions

View file

@ -5,8 +5,10 @@ use ide_db::helpers::SnippetCap;
use itertools::Itertools;
use crate::{
context::ParamKind, item::CompletionKind, render::RenderContext, CompletionItem,
CompletionItemKind,
context::{ParamKind, PatternContext},
item::CompletionKind,
render::RenderContext,
CompletionItem, CompletionItemKind,
};
pub(crate) fn render_struct_pat(
@ -86,7 +88,10 @@ fn render_pat(
_ => return None,
};
if ctx.completion.is_param == Some(ParamKind::Function) {
if matches!(
ctx.completion.pattern_ctx,
Some(PatternContext { is_param: Some(ParamKind::Function), .. })
) {
pat.push(':');
pat.push(' ');
pat.push_str(name);