indentation on lambdas and anonymous methods

I don't like the way Resharper enforces "way right" indentation on lambdas and anonymous methods. I can't find any options to change this behavior.

For example, I want:

button.Click += (sender, e) =>
{
..........blah...
};

However whenever I hit enter after the '=> {' it gives me

button.Click += (sender, e) =>
.......................{
............................blah...
.......................};

This latter situation looks okay in this case, but try the same thing on my MainMapViewWindow.MouseLeftButtonDown event and you end up way the freak on the right. Put a bunch of these events in a row in your code and it looks like the code is scattered willy nilly because no two sets of braces align.

I also don't like how it automatically tries to automatically incorporate the code on the following line when I type the leading brace in the above handler. If I'm making a new handler that involves a brace -- odds are I haven't written the code for that handler yet! What happens now: suppose the above button.Click handler exists. I type in "button2.Click += (sender, e) => {" right above it and then push enter. What do I have now? A button click to add a handler on the other button. Just what I wanted...

Edited by: brantheman on Sep 15, 2008 8:45 PM. My whitespace didn't show up right the first time.

2 comments

Hello,

I don't like the way Resharper enforces "way right" indentation on
lambdas and anonymous methods. I can't find any options to change this
behavior.


The setting is located under the "Other" formatting options. It's possible
to have no indentation for anonimous method bodies.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.