hpack icon indicating copy to clipboard operation
hpack copied to clipboard

Multi-line `flags` `description` produces invalid Cabal file

Open sellout opened this issue 4 months ago • 2 comments

flags:
  meh:
    description: |
      This is some text
      on multiple lines
      that should be indented.
    manual: true
    default: true

produces

flag meh
  description: This is some text
on multiple lines
that should be indented.

  manual: True
  default: True

which causes Cabal to complain

Warning: foo.cabal:53:1: Ignoring section: "that"
Warning: foo.cabal:52:1: Ignoring section: "on"

indenting just one space more than the field name allows it to work

flag meh
  description: This is some text
   on multiple lines
   that should be indented.

  manual: True
  default: True

sellout avatar Oct 21 '25 15:10 sellout

This is definitely a bug. There may also be issues with empty lines and how to handle those across different Cabal versions.

description properly supports both multiple lines and empty lines. It may be possible to reuse that code.

sol avatar Oct 23 '25 00:10 sol

I raised a pull request intended to fix this.

mpilgrem avatar Oct 23 '25 22:10 mpilgrem