问题描述
我正在尝试让jQuery intellisense在Visual Studio中工作.
我正在使用最新的jQuery版本jquery-3.3.1.js和最新的Bootstrap v4.3.1.我已经尝试过Stack Overflow上的所有解决方案,但对我而言仍然没有任何效果.
我尝试引用 jquery-3.3.1.intellisense.js
,但没有任何反应.我还尝试安装jQuery类型的脚本,然后添加 jsconfig.json
并在其中引用jQuery类型的脚本,但不幸的是,再次没有发生任何事情.
要清楚一点,我希望在键入 $
时可以使用智能感知.
这对我有用:
-
在我的解决方案中添加了一个Scripts文件夹,
-
添加了文件"_references.js",
-
在其中添加了我的参考声明到jQuery(我应该升级jQuery,呵呵):
///
关闭/重新打开我的解决方案并预先保存:
这里有一些背景故事: https://www.madskristensen.net/blog/the-story-behind-_referencesjs/
I am trying to get jQuery intellisense working in Visual Studio.
I am using the latest jQuery version jquery-3.3.1.js and latest Bootstrap v4.3.1. I have tried every solution on Stack Overflow but nothing has yet worked for me.
I tried to reference
jquery-3.3.1.intellisense.js
but nothing happened. I also tried installing jQuery typed script and then adding jsconfig.json
and referencing the jQuery typed script in it but unfortunately again nothing happened.
To be clear, I expect intellisense to work when I type
$
.
解决方案
This is what worked for me:
Added a Scripts folder to my solution,
Added a file '_references.js',
Added my reference statements to jQuery (I should upgrade jQuery, huh) in there:
///<reference path="jquery-1.10.2.js" /> ///<reference path="jquery-1.10.2.intellisense.js" />
Closed/Re-opened my solution and presto:
Here is some back story:https://www.madskristensen.net/blog/the-story-behind-_referencesjs/
这篇关于如何在Visual Studio 2019中获取jQuery intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!