diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-02 10:34:23 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-02 10:34:23 +0100 |
commit | 370dbc7867719662f26db5684ac82cfc25b5b8cb (patch) | |
tree | 70c74389382cd3c8ce72dc7739dbe5502f9f7c8b /crates/ra_ide_api/src | |
parent | d21a677715196c46b73017acbae0105ef554284d (diff) | |
parent | 5287a2506c19b7f886556f8a73510f57dd234857 (diff) |
Merge #1087
1087: More future-proof comment kind r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/folding_ranges.rs | 7 | ||||
-rw-r--r-- | crates/ra_ide_api/src/typing.rs | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs index eada0b7de..6987fcc9e 100644 --- a/crates/ra_ide_api/src/folding_ranges.rs +++ b/crates/ra_ide_api/src/folding_ranges.rs | |||
@@ -145,7 +145,10 @@ fn contiguous_range_for_comment<'a>( | |||
145 | visited.insert(first); | 145 | visited.insert(first); |
146 | 146 | ||
147 | // Only fold comments of the same flavor | 147 | // Only fold comments of the same flavor |
148 | let group_flavor = first.flavor(); | 148 | let group_kind = first.kind(); |
149 | if !group_kind.shape.is_line() { | ||
150 | return None; | ||
151 | } | ||
149 | 152 | ||
150 | let mut last = first; | 153 | let mut last = first; |
151 | for element in first.syntax().siblings_with_tokens(Direction::Next) { | 154 | for element in first.syntax().siblings_with_tokens(Direction::Next) { |
@@ -158,7 +161,7 @@ fn contiguous_range_for_comment<'a>( | |||
158 | } | 161 | } |
159 | } | 162 | } |
160 | if let Some(c) = ast::Comment::cast(token) { | 163 | if let Some(c) = ast::Comment::cast(token) { |
161 | if c.flavor() == group_flavor { | 164 | if c.kind() == group_kind { |
162 | visited.insert(c); | 165 | visited.insert(c); |
163 | last = c; | 166 | last = c; |
164 | continue; | 167 | continue; |
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index aeeeea082..ae53bca77 100644 --- a/crates/ra_ide_api/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs | |||
@@ -15,7 +15,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
15 | .left_biased() | 15 | .left_biased() |
16 | .and_then(ast::Comment::cast)?; | 16 | .and_then(ast::Comment::cast)?; |
17 | 17 | ||
18 | if comment.flavor() == ast::CommentFlavor::Multiline { | 18 | if comment.kind().shape.is_block() { |
19 | return None; | 19 | return None; |
20 | } | 20 | } |
21 | 21 | ||