Knockout region highlighting - visual studio 2013

2019-06-28 04:58发布

问题:

Knockout highlighting is not working for me in VS2013. Given that I have the "knockout highlight color" setting:

...my assumption is that it should be working.

However, no dice:

Any ideas?

回答1:

I had the exact same issue. I am a total newbie to Visual Studio, and given that the Web Essentials listed knockoutJS intellisense out of the box I did not think one needed to do anything to 'turn it on'. Also, it seems support for Mustache templating and Angulars ng-bind syntax works out of the box so I was just as perplexed as you.

This is what I did:

I added an entry for a '_refereences.js' file as described in the answer for Intellisense doesn't work for JavaScript in Visual Studio 2012

I then created the file, and dragged the knockout.3.0.0.js file into the code area like descirbed on this blog

That gave me syntax highlight for Knockout data-binds, as well as Intellisense for Knockout.

Edit: Also check out this blogpost by Mads Christensen, the man behind Web Essentials. In the blog post he describes what _references.js is for, and how to use it.