eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Line-wrap documentation #67

Open lucaswerkmeister opened 10 years ago

lucaswerkmeister commented 10 years ago

Normally, the formatter doesn’t touch string literals; however, in the case of doc strings, we could wrap them since we know they’re supposed to be Markdown. The wrap length for these should be a separate option from regular code wrapping, since documentation is mostly text, which is easier to read with shorter lines.

@gavinking you often seem to re-wrap documentation when updating it; do you use some kind of utility for that, or do you do it manually?

gavinking commented 10 years ago

I do it manually. The problem with autowrapping is that you would need to be able to distinguish code blocks, which shouldn't be auto-wrapped.

lucaswerkmeister commented 10 years ago

(We could easily do this for anonymous doc strings since they’re special AST nodes, AnonymousAnnotations; it would be much harder to detect that the string literal in doc("documentation") is documentation, so I’d just not do it there.)

The problem with autowrapping is that you would need to be able to distinguish code blocks, which shouldn't be auto-wrapped.

True, we’d start to get into Markdown parsing… indentation is not enough, because in (nested) lists, code blocks need to be indented further. Tricky.

FroMage commented 9 years ago

+1