Telerik blogs

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.


Japikse
About the Author

Phil Japikse

is an international speaker, a Microsoft MVP, ASPInsider, INETA Community Champion, MCSD, CSM/ CSP, and a passionate member of the developer community. Phil 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 also hosts the Hallway Conversations podcast (www.hallwayconversations.com) and serves as 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, or read his personal blog at www.skimedic.com/blog.

 

Comments

Comments are disabled in preview mode.