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)> { fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
SyntaxKind::FN SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => {
| SyntaxKind::TYPE_ALIAS Some((p, 2))
| SyntaxKind::CONST }
| SyntaxKind::BLOCK_EXPR => Some((p, 2)),
SyntaxKind::NAME_REF => Some((p, 5)), SyntaxKind::NAME_REF => Some((p, 5)),
_ => None, _ => None,
})?; })?;

View file

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