diff options
author | Andrea Pretto <[email protected]> | 2019-01-26 12:21:41 +0000 |
---|---|---|
committer | Andrea Pretto <[email protected]> | 2019-01-26 12:32:48 +0000 |
commit | b9ca8ab868a051fca47462113490433a5085d3c8 (patch) | |
tree | 3fd1f76b847e661d106e381b06ee2a5876026008 /crates/ra_ide_api_light | |
parent | 27c071f7023a529d1c530e2fc3dccc1c0b65c860 (diff) |
Better visibility check.
Diffstat (limited to 'crates/ra_ide_api_light')
-rw-r--r-- | crates/ra_ide_api_light/src/folding_ranges.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ide_api_light/src/folding_ranges.rs b/crates/ra_ide_api_light/src/folding_ranges.rs index 0f2f1399b..87feb9bd8 100644 --- a/crates/ra_ide_api_light/src/folding_ranges.rs +++ b/crates/ra_ide_api_light/src/folding_ranges.rs | |||
@@ -83,7 +83,11 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { | |||
83 | } | 83 | } |
84 | 84 | ||
85 | fn has_visibility(node: &SyntaxNode) -> bool { | 85 | fn has_visibility(node: &SyntaxNode) -> bool { |
86 | return node.descendants().any(|n| n.kind() == VISIBILITY); | 86 | use ast::VisibilityOwner; |
87 | |||
88 | return ast::Module::cast(node) | ||
89 | .and_then(|m| m.visibility()) | ||
90 | .is_some(); | ||
87 | } | 91 | } |
88 | 92 | ||
89 | fn has_newline(node: &SyntaxNode) -> bool { | 93 | fn has_newline(node: &SyntaxNode) -> bool { |