Nostalgic data-binding error in Visual Studio 2012
There seems to be a bug in VS 2012 regarding databinding attributes in .cshtml files and I'm wondering if anyone knows of a fix or workaround for this. I have verified that my colleagues are experiencing the same problem, so I assume everyone is doing it, but I cannot find any reference to it (and I just cannot find a sufficiently suitable set of search terms).
To reproduce the problem, enter this text:
<input type="text" data-bind="value: myValue" />
and paste this into the cshtml file on a blank line twice. When you insert the second, it adds 4 spaces to the data binding and looks like this:
<input type="text" data-bind=" value: myValue" />
This happens under various conditions (always seems to be related to insertion). It's a shame that you have to run and then clear all the spaces.
Does anyone know about fixing this issue in VS2012 (VS2013 is not a solution right now or us).
source to share
The only workable solution I've found so far is to disable the knockout support in intellisense (which I won't miss because I didn't understand what it needs to start with and all it does is, as far as I can tell, a mess of my lines data-bind
) ...
To disable it, I added the following key RegEdit
:
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\HTML Editor]
"KnockoutSupportEnabled"="0"
I will not accept this answer, but will post it here to inform others. I will leave the answer unacceptable in the hope that someone will have a better solution at a later time.
I found this solution on MSDN post.
source to share