Formatter adding unwanted spaces and inconsistently when using multiple cursors
If I wanted to create a lambda that does nothing, I would write:
Action noop = () => {};
However, the formatter seems to want to add a space between the braces, making it:
Action noop = () => { };
I don't want the space there. I only allow spaces for control flow statements.
What makes it worse is that if I'm working elsewhere in the script and enter the empty braces, the entire document is formatted and adds the space to every other existing "NOOP" braces. Fortunately for me, I could undo that last format and keep my intended changes. But I might not even be aware of the change since it can occur anywhere in the document!
public static Action Noop() => () => {};
public static Action<T> Noop<T>() => (_) => {};
public static Action<T1, T2> Noop<T1, T2>() => (_, _) => {};
public static Action<T1, T2, T3> Noop<T1, T2, T3>() => (_, _, _) => {};
public static Action<T1, T2, T3, T4> Noop<T1, T2, T3, T4>() => (_, _, _, _) => {};
// ... up to T16
public static void Noop() => { // add closing brace here and watch the above lines
Speaking of which, things get a little wonky when using multiple cursors. When I initially made this family of these NOOP actions above, I'd start with creating N lines and start typing out base case. Then manually modify each to do what I need. Entering the closing brace can do one of many things, I think depending on the number of cursors and the last action you did.
public static Action Noop() => () => {
public static Action Noop() => () => {
// ...
public static Action Noop() => () => {
public static Action Noop() => () => {
public static Action Noop() => () => {
// multiple cursors above, adding the closing brace to all can either:
// - format the second to last line
// - format the last line
// - remove the indentation of the last two lines, then formats the lines
// - enters the brace as intended and doesn't format the lines... but formats the rest of the document...
// - any combination of the above
// - etc.
Note: this doesn't apply just to lambdas, but any empty block that has no whitespace.
Could this unwanted formatting behavior be removed?