From 5287a2506c19b7f886556f8a73510f57dd234857 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Apr 2019 12:18:52 +0300 Subject: More future-proof comment kind --- crates/ra_ide_api/src/folding_ranges.rs | 7 +++++-- crates/ra_ide_api/src/typing.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_api/src') 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>( visited.insert(first); // Only fold comments of the same flavor - let group_flavor = first.flavor(); + let group_kind = first.kind(); + if !group_kind.shape.is_line() { + return None; + } let mut last = first; for element in first.syntax().siblings_with_tokens(Direction::Next) { @@ -158,7 +161,7 @@ fn contiguous_range_for_comment<'a>( } } if let Some(c) = ast::Comment::cast(token) { - if c.flavor() == group_flavor { + if c.kind() == group_kind { visited.insert(c); last = c; 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