This commit is contained in:
Aleksey Kladov 2020-07-30 18:10:07 +02:00
parent 3cd4112bdc
commit ba71f05438
2 changed files with 5 additions and 6 deletions

View file

@ -106,10 +106,9 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
SyntaxKind::FN
| SyntaxKind::TYPE_ALIAS
| SyntaxKind::CONST
| SyntaxKind::BLOCK_EXPR => Some((p, 2)),
SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => {
Some((p, 2))
}
SyntaxKind::NAME_REF => Some((p, 5)),
_ => None,
})?;

View file

@ -146,8 +146,8 @@ fn n_attached_trivias<'a>(
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
) -> usize {
match kind {
MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF
| MODULE | RECORD_FIELD | STATIC => {
MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF | MODULE
| RECORD_FIELD | STATIC => {
let mut res = 0;
let mut trivias = trivias.enumerate().peekable();