4

For some reason, my jQuery / Javascript intellisense stopped working in Visual Studio. I'm not sure what change caused this to 'break'. I've already gone through and reset all Visual Studio settings. the vsdoc is included in the Site.Master file. Not sure why this isn't working.

<script src="<%= Url.Content("~/Scripts/jQuery/jquery-1.4.1-vsdoc.js") %>" type="text/javascript"></script>

Here is an example of what I get when trying to use intellisense. These are the only options I ALWAYS have.

Intellisense not working.

3 Answers 3

2

I found the problem. I had the vsdoc for jQuery intellisense included, however, using the helper caused it to not work:

<script src="<%= Url.Content("~/Scripts/jquery/jquery-1.7.1-vsdoc.js") %>">
</script>

It is easily fixed by referencing the file like so:

<script src="../../Scripts/jQuery/jquery-1.7.1-vsdoc.js">
</script>

This also seems to be common for CSS intellisense.

Sign up to request clarification or add additional context in comments.

1 Comment

This doesn't seem correct. The -vsdoc file augments the actual .js file with additional comments to help Intellisense along, but none of the code inside is meant to actually be executed by the browser. So, you don't want to ever include it on the page - instead you point to jquery-1.7.1.js, and Visual Studio looks in the same folder for a -vsdoc.js with the rest of the filename the same for additional Intellisense info - not as a replacement for the regular jquery file.
0
/// <reference path="jquery-1.4.1-vsdoc.js"/>

attach the above code in first line of your js file, then you will get the intellisense.

Comments

0

Include the actual jquery file, not the -vsdoc extras:

<script src="~/Scripts/jquery/jquery-1.7.1.js"></script>

Visual Studio automatically looks for the -vsdoc when initializing Intellisense. Try diffing jquery and jquery-1.7.1-vsdoc to see what I mean - you'll notice the -vsdoc file is missing most of jquery, and specifies a lot of classes and functions that don't really need to be spelled out for jquery to work - but they do need to be spelled out for Microsoft's Intellisense to understand it. -vsdoc.js files are specially handled by Visual Studio. You might also notice that when you add one to a Project, Visual Studio automatically sets its Build Action to "None" instead of "Copy" so they won't get deployed when you Publish - since they're only there as additional Visual Studio info.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.