Skip to main content

is_closer_line

Function is_closer_line 

Source
pub fn is_closer_line(line: &str) -> bool
Expand description

Whether line is a pure closing-bracket line.

Most brace languages dedent the closing delimiter back to the parent’s indent (}, };, }), })?;), which leaves the closer outside the block its own body belongs to. Swallowing it keeps a fold’s summary line ending on the brace instead of orphaning it, and keeps the cursor “inside” the block while it sits on the closer.

The heuristic is deliberately narrow: bracket characters plus the punctuation that trails them. } else { is not a closer — it opens a new block, and swallowing it would merge two sibling blocks into one.