JQuery intellisense in Visual Studio Code
Latest (as of April 2017) suggested approach to do this is to use automatic type acquisition by adding jsconfig.json
file in the root of your project with the following contents:
{ "typeAcquisition": { "include": [ "jquery" ] }}
Then, in your editor you will see:
For more information, check official documentation
If you are already familiar with npm (if not you should)
I suggest you install typings which is a typeScript definition manager that work very well with Visual Studio Code (Tested on Mac and Windows)
Simply run
npm install typings --global
Of course you must need to have npm already installed on your local pc/mac.
After that, move to the command line (terminal or cmd) and run
typings install dt~jquery --global --save
It will create the typings directory and all required files (not need to restart Visual Studio Code) and you are ready to go!.
If you want to know more about typings just follow the typings link above.
step 1 : make sure you have the definition files in your projectif you got npm installed then run
npm i --save-dev @types/jquery
it will install jQuery definition file in node_modules/@types/jqueryelse :download it. and put it in any folder then ,step:2 create a jsconfig.json file
$ touch jsconfig.json
and put this code in the jsconfig.json file
{ "include": [ "./node_modules/@types" ], "exclude": [ "./node_modules" ]}
that's it .
**
note : i am excluding ./node_modules in case you have it in your project if not then just include the jquery.d.ts file .
**
thanks