diff options
author | Aleksey Kladov <[email protected]> | 2020-08-25 16:20:29 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-25 16:22:23 +0100 |
commit | 18b667cfcb31b2c5e421d12a34b34e83165603f4 (patch) | |
tree | c9a8da95da29f52b35e7f06171a34ecaeb9b8cfa /crates/ide/src/completion/patterns.rs | |
parent | 6b8bc132dc6dee538964fffa0720480beb5b25dd (diff) |
Complete `pub` in fields
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() |