1

I want to work with Senach Ext Js in a Website project in VisualStudio 2013.

The problem: VisualStudio respectively WebEssentials throws warnings like:

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

Here is the situation as it looks today:

enter image description here

The project is exactly what Sencha Cmd produced for me. 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).

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. So I am looking for the correct configuration for both use cases: WebEssential JSHint Warnings and 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)?
  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)?)

Update: Related question:

Enabling JSHint Support for Ext.js in Intellij Idea

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."

Source: 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:

intellisense error

Community
  • 1
  • 1
Matthias
  • 1,386
  • 3
  • 24
  • 59
  • http://stackoverflow.com/questions/20529664/how-do-you-use-jshint-jshintrc-file-with-visual-studio-2013-web-essentials-ex does this help? – Colin Ramsay Dec 23 '14 at 10:15
  • Yes thank you something similar I have under update: related question. I think the JsHint warning can be solved but not the intellisense. – Matthias Dec 23 '14 at 10:22
  • I found another one here: http://www.sencha.com/forum/showthread.php?287329-Does-Visual-Studio-2013-support-the-intellisense-of-EXTJS-5 Maybe the _reference.js is not in the right place? – Matthias Dec 23 '14 at 10:26
  • Maybe, you don't have a /scripts/ directory in the screenshot above... – Colin Ramsay Dec 23 '14 at 10:48
  • I do not know. Does the whole JavaScript need to be in Scripts? Tried to put _references.js in a new Scripts folder and then refrerence from there with a leading / to search the other Js files in the project's root. – Matthias Dec 23 '14 at 11:00
  • No, I think the Ext JS JavaScript files can be anywhere so long as the path is right. See the "Reference Directives" section here: http://msdn.microsoft.com/en-us/library/bb385682.aspx – Colin Ramsay Dec 23 '14 at 11:10
  • still not working when I have the _references in a new "Script" folder. – Matthias Dec 23 '14 at 12:41
  • It is solved now? It seems to take a while. I do not know. – Matthias Dec 23 '14 at 12:42
  • When you changed the _reference.js file VS would still have to go and index the Ext JS JavaScript file, and since it's pretty big it might have taken a few minutes to do that. – Colin Ramsay Dec 23 '14 at 12:44

1 Answers1

1

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. This enables Visual Studio to index the Ext JS source for Intellisense. For example:

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

More on the Intellisense and _reference.js:

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.

Colin Ramsay
  • 16,086
  • 9
  • 52
  • 57
  • 1
    It seems to take a while for VS to update. Finally it is working. Thank you. Maybe the Jshint configuration for "Ext" is then not even required. – Matthias Dec 23 '14 at 12:53
  • I checked. It actually is required and JsHint throws another 503 Warnings about Ext Js :( I think I am going to deactivate it completely. – Matthias Dec 23 '14 at 12:57
  • Have you tried configuring jshint as normal with a .jshintrc file in your project root? Then you can add "Ext" as a global for jshint. Anyway you could always start a new question solely about that. – Colin Ramsay Dec 23 '14 at 12:59
  • Follow-up question: http://stackoverflow.com/questions/27621046/jshint-with-ext-js-in-visualstudio – Matthias Dec 23 '14 at 13:08