aXen / web-indent

Automatically exported from code.google.com/p/web-indent
0 stars 0 forks source link

Wrong indention on multiline variable declaration #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a multiline list of variable declarations

What is the expected output? What do you see instead?

Expect something like this:
var var1, var2
\t  var3, var4;

Get something like that:
var var1, var2,
var3, var4;

What version of the product are you using? On what operating system?
Latest from here: http://www.vim.org/scripts/script.php?script_id=3081
OS is Windows.

Original issue reported on code.google.com by daniel.b...@gmx.de on 24 Apr 2011 at 4:26

GoogleCodeExporter commented 9 years ago
That is the expected output for now.  I've been thinking about changing it.

Original comment by pkopr...@gmail.com on 15 May 2011 at 5:25

GoogleCodeExporter commented 9 years ago
Personally I'd go with the indented version. As far as I can tell, it is very 
common to indent one level if your span over more than one line with any 
statement / expression, eg complex if statements. You wouldn't do something 
like this:

if (exp1 && exp2 && exp3
&& exp4) {
}

but rather 

if (exp1 && exp2 && exp3
\t  && exp4) {
}

This is also true for all other multiline constructs I can thin of. Of course, 
in the end, it comes down to personal preference. I do think however, indenting 
after a linebreak in a multiline statement is very common and generally 
accepted.

Original comment by daniel.b...@gmx.de on 15 May 2011 at 6:12