Visual Studio Code中的JQuery intellisense [英] JQuery intellisense in Visual Studio Code
问题描述
我决定跳进Visual Studio Code来创建一个应用程序。
现在我似乎无法让intellisense为JQuery和JQuery Mobile工作。
我的VSC版本是0.10.1
我尝试添加 reference.d.ts
文件使用此内容
///< reference path =js / jquery.d.ts/>
///< reference path =js / jquerymobile.d.ts/>
(从
有关详细信息,请查看官方文档
I decided to jump in Visual Studio Code to create an app.
Now I can't seem to get intellisense working for both JQuery and JQuery Mobile.
My VSC version is 0.10.1
I tried adding a reference.d.ts
file with this contents
/// <reference path="js/jquery.d.ts"/>
/// <reference path="js/jquerymobile.d.ts"/>
(files downloaded from https://github.com/DefinitelyTyped/DefinitelyTyped)
I tried opening a .js
file, add a $(this)
and hitting ctrl+period but it
says 'No suggestions'.
Something I missed?
UPDATE:
Tried adding a jsconfig.json
file following https://code.visualstudio.com/docs/languages/javascript#_javascript-projects-jsconfigjson
{
"files": [
"js/jquery.d.ts",
"js/jquerymobile.d.ts"
]
}
Restarted, nothing...
UPDATE 2:
added a .js
file, typed $
and clicked on the lightbulb to download jquery.d.ts file. It warns me about adding this file to the jsconfig.json file.
After doing all this, restarted still not working.
jsconfig.json
file contents:
{
"files": [
"typings/jquery/jquery.d.ts"
]
}
Nothing!
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
这篇关于Visual Studio Code中的JQuery intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!