diff options
Diffstat (limited to 'crates/ide/src/completion/patterns.rs')
-rw-r--r-- | crates/ide/src/completion/patterns.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ide/src/completion/patterns.rs b/crates/ide/src/completion/patterns.rs index ffc97c076..c6ae589db 100644 --- a/crates/ide/src/completion/patterns.rs +++ b/crates/ide/src/completion/patterns.rs | |||
@@ -34,6 +34,14 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { | |||
34 | fn test_has_impl_parent() { | 34 | fn test_has_impl_parent() { |
35 | check_pattern_is_applicable(r"impl A { f<|> }", has_impl_parent); | 35 | check_pattern_is_applicable(r"impl A { f<|> }", has_impl_parent); |
36 | } | 36 | } |
37 | pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { | ||
38 | not_same_range_ancestor(element).filter(|it| it.kind() == RECORD_FIELD_LIST).is_some() | ||
39 | } | ||
40 | #[test] | ||
41 | fn test_has_field_list_parent() { | ||
42 | check_pattern_is_applicable(r"struct Foo { f<|> }", has_field_list_parent); | ||
43 | check_pattern_is_applicable(r"struct Foo { f<|> pub f: i32}", has_field_list_parent); | ||
44 | } | ||
37 | 45 | ||
38 | pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { | 46 | pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { |
39 | not_same_range_ancestor(element).filter(|it| it.kind() == BLOCK_EXPR).is_some() | 47 | not_same_range_ancestor(element).filter(|it| it.kind() == BLOCK_EXPR).is_some() |