Select to view content in your preferred language

3.1 API Intellisense in VS2010

513
1
08-06-2012 02:57 PM
MeleKoneya
Frequent Contributor
I have updated a JavaScript web application created in Visual Studio 2010 to the new 3.1 API and am using the Intellisense VSDOC file available here:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/api_codeassist.htm

This looks to be very handy for Visual Studio users, but I was not able to get it work within my HTML file.   I have my HTML file, scripts, and styles in seperate files so I placed the following in my .html file:

<script type="text/javascript" src="Assets/scripts/jsapi_vsdoc_v31.js"></script>

But when I run the project,   I get an error in IE that says "Expected identifier, string or number" which refers to the above JavaScript file and there is no intellisense.

I can get intellisense to work in my JavaScript files by using the following reference 

/// <reference path="~/Assets/Scripts/jsapi_vsdoc_v31.js" />,

but the problem is that I have several JavaScript files and I have to add the reference to each JavaScript file.    Has anyone been able to get this to work in the HTML file or is there another way to use Intellisens without having to add the 'reference' to each JavaScript file?

Thanks,

Mele
0 Kudos
1 Reply
JohnGravois
Deactivated User
I was able to get code assist up and running in an HTML file in Visual Studio 2010 (Professional SP1) by copy/pasting one of our published samples and adding an identical script reference tag to the one you posted above.

Something I noticed though is that, within the HTML file, the intellisense only appears within script blocks explicitly declared as javascript

<script type="text/javascript">
//intellisense will appear here, but not outside the block...
</script>


Does it make any difference if you use a full http path to reference the script instead of a relative path?
0 Kudos