Jon
Jon

Reputation: 1705

What's the keystroke?

I had case today where I was moving some C# code around and my fat fingers inadvertantly bumped some keys. I had a line that read:

List<IntSite> siteList = ...

and after the keyboard fumble, it was all spaced out like so:

List < IntSite > siteList = ...

I can't seem to find the shortcut that did that... anyone know?

Upvotes: 1

Views: 122

Answers (2)

Mir
Mir

Reputation: 464

If your style is set to insert whitespaces that way, it looks like CTRL-K + CTRL-D, or CTRL-K + CTRL-F if you had text selected.

Your fingers might be up to something if they did that on their own!

Upvotes: 1

Abel
Abel

Reputation: 57159

Auto layout of your code does that. If you, for instance, copy and paste some code, it is laid out automatically for you, provided the code is syntactically correct.

Now, if you hit Ctrl-Z (Undo) right after such a copy/paste, or right after you hit ;, Enter or } or any other key that performs auto-layout, the layout is reverted.

Suppose I take the following snippet:

List < int > x = new List < int > () ;

and I copy and paste it in Visual Studio, it will look like:

List <int> x = new List <int>();

If I now hit Ctrl-Z it will be reverted to the original spacy layout.

Of course, this is a guestimate, but perhaps you inadvertently hit Ctrl-Z.

Upvotes: 1

Related Questions