WinJS

.NET Musings

Wandering thoughts of a developer, architect, speaker, and trainer

NAVIGATION - SEARCH

Fixing Visual Studio 2012 Intellisense for WinJS Files

I have been frustrated by Intellisense acting up when working on WinJS Windows Store applications.  Figure 1 is just an example of the quirky behavior that I’ve been experiencing:

image
Image 1

Fortunately, the fix is extremely easy, and I picked it up from Adam Freeman’s book on Apress “Metro Revealed: Building Windows 8 apps with HTML5 and Javascript

Add references in your JavaScript files to ui.js and base.js.  You can do this by dragging the files from your solution explorer.  They are located by expanding Windows Library for JavaScript 1.0, and then the “js”  folder.  Make sure you include the triple swack at the beginning of the line so VS know that they are a reference.  A double swack won’t work.

Once you do, you’ll find that Intellisense works wonderfully!

image

Update

Any JavaScript files that are referenced in an HTML file will also enable Intellisense within that file.  The workflow for this is:

  1. 1. Create and Save JavaScript file
  2. 2. Open HTML file in your project (e.g. default.html)
  3. 3. Add .js file <script> tag in the appropriate location and order
  4. 4. Go back to you new .js and start working

Personally, I think it’s too much friction between File->New and typing, especially when you can use JustCode templates (see this blog post) to add in the ///<reference/> tags.  But, the choice is yours.

About the author

Philip Japikse

2012STLDODN.93x112 Philip Japikse an international speaker, a Microsoft MVP, INETA Community Champion, MCSD, CSM/ CSP, and a passionate member of the developer community, Phil Japikse has been working with .Net since the first betas, developing software for over 20 years, and heavily involved in the agile community since 2005. Phil works as a Developer Evangelist for Telerik's RadControls for Windows 8 as well as the Just family of products (JustCode, JustMock, JustTrace, and JustDecompile) and hosts the Zero To Agile podcast (www.telerik.com/zerotoagile). Phil is also the Lead Director for the Cincinnati .Net User’s Group (http://www.cinnug.org). You can follow Phil on twitter via www.twitter.com/skimedic and read his personal blog at www.skimedic.com/blog.

Managed Windows Shared Hosting by OrcsWeb