def comment_text.after

bend-lint-rules@0.2.0.0 · layout/format.bend:1413

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import 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      )

Uses (7)

Used by (1)