简体   繁体   English

Visual Studio中对Ext Js的Intellisense和JsHint支持

[英]Intellisense and JsHint support for Ext Js in VisualStudio

I want to work with Senach Ext Js in a Website project in VisualStudio 2013. 我想在VisualStudio 2013的网站项目中使用Senach Ext Js。

The problem: VisualStudio respectively WebEssentials throws warnings like: 问题: VisualStudio分别向WebEssentials发出如下警告:

JsHint (W117): 'Ext' is not defined.

Here is the situation as it looks today: 这是今天的情况:

在此处输入图片说明

The project is exactly what Sencha Cmd produced for me. 该项目正是Sencha Cmd为我制作的。 At the moment I want only a Website project and no server sided code involved (therefore I did not make a MVC or Web API project). 目前,我只想要一个网站项目,不涉及服务器片面代码(所以我没有做一个MVC或Web API项目)。

I know that there is a way to define some global symbols in each JavaScript file for JsHint, but I want to get the intellisense working too. 我知道有一种方法可以在每个JavaScript文件中为JsHint定义一些全局符号,但是我也想让智能感知工作。 So I am looking for the correct configuration for both use cases: WebEssential JSHint Warnings and Intellisense . 因此,我正在寻找两种用例的正确配置: WebEssential JSHint警告和Intellisense

Maybe both problems need to be addressed separately. 也许两个问题都需要分别解决。 That would be fine too. 也可以。

  1. Is my directory structure correct (just took what Sencha Cmd built for me)? 我的目录结构是否正确(仅使用了Sencha Cmd为我构建的内容)?
  2. How to address the problem to make intellisense working? 如何解决使智能感知工作的问题?
  3. (How to avoid Webessential JavaScript warnings (it seems most or all of them are JsHint)?) (如何避免Webessential JavaScript警告(似乎大多数或所有警告都是JsHint)?)

Update: Related question: 更新:相关问题:

Enabling JSHint Support for Ext.js in Intellij Idea 在Intellij Idea中为Ext.js启用JSHint支持

Update: 更新:

"An _references.js file in any other location than “~/Scripts/_references.js” will be just like any other JS file and won't be used for global intellisense. Even putting the file in the root of your web project will not work as well." “位于“〜/ Scripts / _references.js”以外的任何其他位置的_references.js文件将与其他JS文件一样,不会用于全局智能。即使将文件放在Web项目的根目录下,效果也不佳。”

Source: http://gurustop.net/blog/2012/03/03/javascript-js-intellisense-auto_complete-in-visual-studio-11-beta-the-web-_references-js-file/ 来源: http : //gurustop.net/blog/2012/03/03/javascript-js-intellisense-auto_complete-in-visual-studio-11-beta-the-web-_references-js-file/

still not working when I have the _references in a new "Script" folder: 在新的“脚本”文件夹中有_references时,仍然无法正常工作:

智力错误

So it seems like the final answer was to add a file called ~/scripts/_reference.js and then include a line to reference Ext JS in there. 因此,似乎最终的答案是添加一个名为〜/ scripts / _reference.js的文件,然后在其中包含引用Ext JS的行。 This enables Visual Studio to index the Ext JS source for Intellisense. 这使Visual Studio可以为Intellisense索引Ext JS源。 For example: 例如:

/// <reference path="../ext/ext-all-debug-full.js" />

More on the Intellisense and _reference.js: 有关Intellisense和_reference.js的更多信息:

http://msdn.microsoft.com/en-us/library/bb385682.aspx http://msdn.microsoft.com/en-us/library/bb385682.aspx

Note that due to the size of the Ext JS codebase, Visual Studio might take a few minutes to complete the indexing process and for Intellisense to start working smoothly. 请注意,由于Ext JS代码库的大小,Visual Studio可能需要几分钟才能完成索引过程,并使Intellisense能够顺利开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM