2010年10月7日 下午 10:35
I realize I have a lazy shift finger that likes to stay on the shift key when putting in the finishing paren on a function definition to get to the new line and place the curly braces. The problem is that the Automatic Brace Completion uses this hotkey to do some automatic formatting. I ended up not liking the way it did the automatic formatting and decided to turn off that feature.
Now my problem is that the old default functionality for SHIFT-ENTER is not restored. I just want to be able to hold the shift key and press enter to get to create a new line in my code; but instead, it now does nothing. The cursor just sits there mocking my attempt to create beautifully formatted code.
Is there a way to restore the default handling of using SHIFT-ENTER?
2010年10月7日 下午 10:46
Ha! I figured it out on my own. Firstly, when you switch the Automatic Brace Completion On/Off; you need to restart Visual Studio. This isn't a surprise, as it tells you right in the options when you switch it. However, it wasn't immediately apparent that you need to close ALL instances of Visual Studio that you have open for the change to take effect.
Secondly, and most importantly, I found how/where to reassign the hotkey to return the default functionality back in the IDE. The first step is to turn off the Automatic Brace Completion option for the Productivity Power Tools and close all open Visual Studio instances. Reopen Visual Studio and open the Tools->Options->Environment->Keyboard dialog. Type in the following text in the Show commands containing textbox: Edit.BreakLine
Select it in the results window. Make sure Global is selected for the Use new shortcut in dropdown. Put focus on the Press Shortcut Keys textbox area and press SHIFT-ENTER. Click the Assign button. Click OK.
Whalah! You now have your default SHIFT-ENTER functionality.
- 已標示為解答 Belcaw 2010年10月7日 下午 10:46