Reputation: 33
This is my first question on stackoverflow, so here goes:
I've got this annoying problem/feature in Visual Studio 2015. The problem is every time I create an if statement, for, while, etc. with autocomplete (tab-tab). When I then go to the line of the end bracket and try to create a new line (simple press of Enter) right after it, my text cursor will immediately jump into the brackets, instead of making a new line.
I've looked far an wide as for trying to disable this "feature" as it is incredibly annoying. But I have not been able to find any information on it anywhere, so now I am asking you all this question.
Thank you!
How I produce the problem:
Upvotes: 3
Views: 566
Reputation: 11450
The 'problem' is that when using the tab key you are activating the snippets feature. After typing tab you are in 'snippet editing' mode, where each tab (and shift + tab) are used to navigate the placeholders defined by the snippet. In snippet mode, the Enter key always takes you wherever the person who designed the snippet thought it was the best place to leave the cursor after that snippet. For the if
snippet that happens to be inside the brackets.
The good news is that you can create your own snippets, and even modify existing snippets to change their behaviour. However, as far as I know this involves manually editing snippet definition files (xml files) or using external extensions. For example: http://blogs.msdn.com/b/visualstudio/archive/2014/01/15/visually-creating-snippets.aspx
As a workaround, you can also just press Esc to exit snippet editing mode before pressing Enter.
Upvotes: 4