aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/completion/patterns.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/completion/patterns.rs')
-rw-r--r--crates/ide/src/completion/patterns.rs8
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 {
34fn test_has_impl_parent() { 34fn 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}
37pub(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]
41fn 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
38pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { 46pub(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()