Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference JS file in Other JS File and Intellisense

I've been learning JQuery and I am writing my custom jquery codes in Custom.js file. Actually what I am trying to do is, activate intellisense for Jquery in visual studio but it's not working and I want intellisense to also work in custom.js file where actually I'm writing my custom logic and codes.

I thought it could be solved by reference jquery-1.3.2-vsdoc2.js in custom.js.

I've downloaded and installed update pack of jquery for visual studio 2008 on my computer.

So what should I do to activate intellisense.

Thanks in advance.

like image 488
Tarik Avatar asked Jul 21 '09 00:07

Tarik


People also ask

What is JavaScript IntelliSense?

IntelliSense# Visual Studio Code's JavaScript IntelliSense provides intelligent code completion, parameter info, references search, and many other advanced language features.

Can you have multiple scripts in a JS file?

You can write your JS in separate files, but when it comes to deploying, it's more efficient to minify them all into a single file. For each script you load in your browser, you make a round-trip to the server, so it makes sense to minimize those. Also, take a look at, for example, jquery source on github.


1 Answers

First, when using Visual Studio 2008, install hotfix KB958502. Second, download the vsdoc file to the same folder as the original jQuery.js file, and make sure that file names match, i.e. if original file name is jquery-1.3.2.js, then the vsdoc file should be named jquery-1.3.2-vsdoc.js (notice: not vsdoc2.js); if you're using the min version of the file, adjust the name accordingly. Third, do not include the vsdoc file in the project (it's enough for the file to be in the same folder). Finally, to enable IntelliSense in custom JavaScript files, add the following line at the top of the JavaScript file (enter the correct path):

/// <reference path="path-to-vsdoc-file" />

Bonus: To refresh JavaScript IntelliSense, press Ctrl+Shift+J.

like image 146
Alek Davis Avatar answered Nov 10 '22 15:11

Alek Davis