[qooxdoo-bugs] [Bug 1467] pretty formatter mutilates comments
Brought to you by:
ecker,
martinwittemann
From: <bug...@qo...> - 2011-05-18 13:47:00
|
http://bugzilla.qooxdoo.org/show_bug.cgi?id=1467 --- Comment #11 from Thomas Herchenroeder <th...@us...> --- Fixed in trunk with r27307. The issue needed to be addressed in the parser. When a multiline comment is encountered during parsing, leading white space up to the start of the comment are already processed, so are not known to the comment token itself. But then the rest of the comment is included in the token, including all the indentation of the subsequent lines. When the comment is then re-inserted during pretty-printing, *all lines* are equally indented. The first line thus gets to the correct position, but all subsequent lines are indented *additionally* to the white space they already contain. This lead to this double-indentation of comment lines beyond the first. The fix was to normalize leading white space during parsing. The column position of the first line is known when the comment is encountered, and that much spaces are stripped from subsequent lines (if they have at least that much leading white space). This seems to work well for stand-alone multiline comments. It will not work when tabs are used as leading white space (But tabs are deprecated as indentation anyway). It will not work as expected if a multiline comment starts at the end of a normal code line, and the subsequent lines are alined with the comment. E.g. var a = 3; /* this var is used throught the rest of this file */ will give you var a = 3; /* this var is used throught the rest of this file */ under pretty printing. The "relative offset" of the subsequent lines to the comment start is retained, but not the absolute. -- Configure bugmail: http://bugzilla.qooxdoo.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |