Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping Visual Studio 2013 from moving my cursor around when editing HTML classes

I'm getting really frustrated by a feature that's seemingly been introduced in Visual Studio 2013. I have a piece of HTML like this:

<div class="test"></div>

If I move my cursor to alongside test so that I can add another class to the tag, which should result in this:

<div class="newclass test"></div>

...the moment that I press the SPACE key after typing newclass, Visual Studio automatically moves my cursor to outside the attribute and adds the space there instead, leaving me with:

<div class="newclasstest" ></div>

I've trawled through the text editor settings and disabled every auto-complete option or similar I can find. It's really messing with my workflow as one of my projects is very heavy on multiple classes so it's a constant hurdle.

like image 472
Ryan Williams Avatar asked Oct 21 '22 16:10

Ryan Williams


1 Answers

The option to disable this is Insert attribute value quotes in Options > Text Editor > HTML > Advanced.

Unfortunately, this leaves you without the long-standing useful feature of getting attribute value quotes automatically inserted.

Your other choice is to hit ESC before hitting space. It seems like this is just going to have to be a reflex behavior Microsoft is forcing us to learn.

One quirk to this behavior is that if there is a space somewhere in front of your cursor, it will not jump outside the quotes. If you have:

<div class="newclass test"></div>

you can safely add anotherclass without it leaping out.

<div class="anotherclass newclass test"></div>

and now you can add onemoreclass anywhere behind test and it won't jump out.

<div class="anotherclass newclass onemoreclass test"></div>

However, since you'll need to hit ESC Space in the extremely common situation of adding two classes one after the other, you'll probably have smacking ESC ingrained in you and will be hitting it everytime regardless.

like image 80
friggle Avatar answered Jan 02 '23 19:01

friggle