diff options
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r-- | crates/ra_ide/src/completion/complete_trait_impl.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index 7d9050a6b..87221d964 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! | 2 | //! |
3 | //! This module adds the completion items related to implementing associated | 3 | //! This module adds the completion items related to implementing associated |
4 | //! items within a `impl Trait for Struct` block. The current context node | 4 | //! items within a `impl Trait for Struct` block. The current context node |
5 | //! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node | 5 | //! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node |
6 | //! and an direct child of an `IMPL_DEF`. | 6 | //! and an direct child of an `IMPL_DEF`. |
7 | //! | 7 | //! |
8 | //! # Examples | 8 | //! # Examples |
@@ -87,7 +87,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | SyntaxKind::CONST_DEF => { | 90 | SyntaxKind::CONST => { |
91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) | 91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) |
92 | .into_iter() | 92 | .into_iter() |
93 | .filter_map(|item| match item { | 93 | .filter_map(|item| match item { |
@@ -106,10 +106,9 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
106 | 106 | ||
107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | 107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { |
108 | let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { | 108 | let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { |
109 | SyntaxKind::FN | 109 | SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { |
110 | | SyntaxKind::TYPE_ALIAS | 110 | Some((p, 2)) |
111 | | SyntaxKind::CONST_DEF | 111 | } |
112 | | SyntaxKind::BLOCK_EXPR => Some((p, 2)), | ||
113 | SyntaxKind::NAME_REF => Some((p, 5)), | 112 | SyntaxKind::NAME_REF => Some((p, 5)), |
114 | _ => None, | 113 | _ => None, |
115 | })?; | 114 | })?; |
@@ -201,7 +200,7 @@ fn add_const_impl( | |||
201 | } | 200 | } |
202 | } | 201 | } |
203 | 202 | ||
204 | fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { | 203 | fn make_const_compl_syntax(const_: &ast::Const) -> String { |
205 | let const_ = edit::remove_attrs_and_docs(const_); | 204 | let const_ = edit::remove_attrs_and_docs(const_); |
206 | 205 | ||
207 | let const_start = const_.syntax().text_range().start(); | 206 | let const_start = const_.syntax().text_range().start(); |