mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
More future-proof comment kind
This commit is contained in:
parent
d21a677715
commit
5287a2506c
4 changed files with 59 additions and 37 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue