diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 17:28:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 17:28:28 +0100 |
commit | c5798c4d75aa807aec47208a49101bdec3affcca (patch) | |
tree | 1af0efdcee857e1ba91e76f4cc7fd7c043916ebb /crates/ra_ide/src/completion/complete_trait_impl.rs | |
parent | c83467796b6c7365ea4f41900d74444384a9e618 (diff) |
Finalize impl Grammar
Diffstat (limited to 'crates/ra_ide/src/completion/complete_trait_impl.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_trait_impl.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index 87221d964..d9a0ef167 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -3,7 +3,7 @@ | |||
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` 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`. |
7 | //! | 7 | //! |
8 | //! # Examples | 8 | //! # Examples |
9 | //! | 9 | //! |
@@ -34,7 +34,7 @@ | |||
34 | use hir::{self, Docs, HasSource}; | 34 | use hir::{self, Docs, HasSource}; |
35 | use ra_assists::utils::get_missing_assoc_items; | 35 | use ra_assists::utils::get_missing_assoc_items; |
36 | use ra_syntax::{ | 36 | use ra_syntax::{ |
37 | ast::{self, edit, ImplDef}, | 37 | ast::{self, edit, Impl}, |
38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, | 38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, |
39 | }; | 39 | }; |
40 | use ra_text_edit::TextEdit; | 40 | use ra_text_edit::TextEdit; |
@@ -104,7 +104,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | 107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, Impl)> { |
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 | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { | 109 | SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { |
110 | Some((p, 2)) | 110 | Some((p, 2)) |
@@ -114,7 +114,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | |||
114 | })?; | 114 | })?; |
115 | let impl_def = (0..impl_def_offset - 1) | 115 | let impl_def = (0..impl_def_offset - 1) |
116 | .try_fold(trigger.parent()?, |t, _| t.parent()) | 116 | .try_fold(trigger.parent()?, |t, _| t.parent()) |
117 | .and_then(ast::ImplDef::cast)?; | 117 | .and_then(ast::Impl::cast)?; |
118 | Some((trigger, impl_def)) | 118 | Some((trigger, impl_def)) |
119 | } | 119 | } |
120 | 120 | ||