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 breaks and multi-line comments #54

Closed lucaswerkmeister closed 10 years ago

lucaswerkmeister commented 10 years ago

Currently, multi-line comments enforce a line break. However, you can obviously stick a line comment anywhere – even between tokens that disallow a line break completely. This happens, for example, in ceylon.language (here), and it blows up the formatter because the intersection of the two ranges of allowed line breaks is empty.

However, if I simply allow line breaks before multi-line comments (turn the range from 1..3 into 0..3), then 0 becomes the default value, which I don’t really like. I’d like to have an allowed range of 0..3, but a default value of 1. As 1 is neither of the borders, this isn’t possible in the current model.

lucaswerkmeister commented 10 years ago

Given that the line breaks for comments are handled in only one place – fastForwardComment – I could actually implement a special rule only for comments there. Or do I need this for other tokens as well?