Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio 2010 + resharper bracket indentation problem

I'm using VS 2010 + resharper, and i'm tired reformatting bracket indentation in code as i want it. As example if i have code like:

operators.Keys
    .ToList()
    .ForEach(k => filters
        .AddRange(CustomHtmlHelpers.GetIdAndValueListByPrefix(queryString, k)
            .Select(t => new QueryFilter()
            {
                Operation = operators[k],
                PropertyName = t.Item1,
                Value = t.Item2
            })))

And if i put ; in the end VS (or resharper) 'fixes' bracket indentation so code becomes like:

operators.Keys
    .ToList()
    .ForEach(k => filters
                        .AddRange(CustomHtmlHelpers.GetIdAndValueListByPrefix(queryString, k)
                                    .Select(t => new QueryFilter()
                                    {
                                        Operation = operators[k],
                                        PropertyName = t.Item1,
                                        Value = t.Item2
                                    })));

Same happens if i use resharper's code cleanup. I probably could turn off automatic code reformatting on ; but i need it in other situations. I tried changing code formating options both in VS and resharper setting but never got indentation as i want it.

How could i configure vs or resharper so that it would not do more than one tab formating? Or maybe there is other plugin i can use (together with r#) specificly for this purpose?

EDIT: for anyone interested in this problem here is same question in r# forum http://devnet.jetbrains.net/thread/304794 anyone who would like to see better nested code indentation from r# are welcome to vote for it here http://youtrack.jetbrains.net/issue/RSRP-88220

like image 275
Andrej Slivko Avatar asked Jun 03 '11 07:06

Andrej Slivko


1 Answers

just guessing...

go to ReSharper -> options -> Code Editing -> c# -> Formatting Style -> Other

Search in Align Multiline Constructs and try toggling the state of checkbox "Chained method calls" (I suppose your value is 'checked' for this checkbox).

if not this one, i expect that required setting is somewhere very near :-)

like image 178
Marzena Avatar answered Oct 05 '22 23:10

Marzena