def comment_text.after
import bend-lint-rules@0.2.0.0/layout/format.bend as Formatimport Base
1413# "#x" gets a space; empty comments, whitespace, test expectations (#|),
1414# directives (#!) and headings (##) stay as they are.
1415def comment_text.after(rest: String, +keep: String) -> String:
1416 match rest:
1417 case SNil{}:
1418 "#"
1419 case SCon{+c, more}:
1420 Bool.pick(
1421 String,
1422 is_blank(c) || Char.is_eq(c, '#') || Char.is_eq(c, '!') || Char.is_eq(c, '|'),
1423 "#" ++ keep,
1424 "# " ++ keep
1425 )