I found while playing around with Knockout.js, that my Visual Studio Intellisense wasn’t working. This turned out to be because I had formatted my Scripts folder, and moved standard Javascript libraries into another folder.
This meant that Visual Studio couldn’t find my _references.js file.
At first I added the following to the @Scripts Section in my .vbhtml file;
1: @Code
2:
3: If (False) Then
4:
5: @<script src="/Scripts/lib/knockout-2.2.1.debug.js" type="text/javascript"></script>
6:
7: End If
8:
9: End Code
But this would end up being silly if I had lots of files. So, I had a quick look around and found a couple of useful answers on Stack Overflow;
http://stackoverflow.com/a/12016530/1305169 and
http://stackoverflow.com/a/12628049/1305169
Where, basically, you need to add a reference to your new _references.js file to the Intellisense list options in Visual Studio;
- In Visual Studio, go to Tools > Options > Text Editor > Javascript > Intellisense > References
- In the “Add a reference to current group”, type in the relative path to your _references.js file (for me this was “~/Scripts/lib/_references.js”
Hey presto, you should now have working intellisense!
No comments:
Post a Comment