Enabling IntelliSense for Mobile Services JavaScript in Visual Studio

Enabling IntelliSense for Mobile Services JavaScript in Visual Studio

Rate This
  • Comments 7

In a previous post , we shared the new Windows Azure Mobile Services integration and capabilities in Visual Studio 2013. These include the ability to edit your Mobile Services table scripts. In this post, we describe how you can enable IntelliSense on your server side scripts in Visual Studio. This is a capability that isn’t integrated in Visual Studio 2013 Preview, following the steps below will help you turn it on.

To get started, download our IntelliSense definition files from here . Save these files to a relatively easy to access path.

How much IntelliSense?

The files we're releasing today provide you IntelliSense for your Mobile Services table scripts in Visual Studio. This includes working with data using the tables API, sending push notifications using the push API and working directly with SQL using the mssql API. Here's a quick example of what it looks like:

Intellisense

See the ReadMe for more information on limitations and certain exclusions in the definition files.

Enabling IntelliSense

There are two ways to enable IntelliSense on your server side scripts in Visual Studio 2013 Preview. Use the first method (add an explicit reference to specific script files) if you don't want to affect IntelliSense for other JavaScript files that you edit in Visual Studio. For example, if your Windows Store app is in JavaScript, then you don’t want IntelliSense for your client side JavaScript files to be injected with Mobile Services definitions. Use the second method (add a reference through Tools -> Options) when you want to enable IntelliSense in all your server side scripts without any changes to the scripts themselves. The second method may be more suitable if your client project is a Windows Store app in C#, VB, or C++.

1. Add an explicit reference to specific script files

In the script where IntelliSense is desired, open the script file (e.g. Insert.js) and add a reference to mobileservices.intellisense.js in a comment above the parent method declaration. Path defines the destination on disk where you saved the mobileservices.intellisense.js reference file.

Here’s what this will look like if the IntelliSense file is saved to C:\IntelliSense:

Adding an explicit reference to specific script files

2. Add a reference through Tools -> Options

IntelliSense can also be enabled by adding a reference to mobileservices.intellisense.js through the Tools-> Options dialog. This will add Mobile Services definitions to any JavaScript file.

  1. Choose Tools, Options, Text Editor, JavaScript, IntelliSense, and References.
  2. Change the Reference Group to “Implicit (Web).”
  3. Browse (…) to the location on disk where you saved the mobileservices.intellisense.js file and choose Open.

Adding a reference through Tools Options

Note that both procedures only apply to your machine, if you work in a team or attempt to edit the scripts on other machines, copy the files to each machine and follow the instructions above. If you edit the scripts in the Windows Azure Management Portal, you will not receive IntelliSense support.

We hope you will find this short post helpful when you take advantage of the great Windows Azure Mobile Services integration with Visual Studio 2013. Please tell us what you think via the send-a-smile feature, submit bugs through Microsoft Connect, or post on Visual Studio User Voice.

image

Merwan Hade: Program Manager, Visual Studio Windows Azure Tools

Merwan is a Program Manager with the Windows Azure Tools team in Visual Studio. He has worked on a number of tooling features, all designed to make it easier for developers to build and debug applications powered by Windows Azure. Merwan is passionate about app development, especially in the mobile space.

image

Paul Batum – Program Manager, Windows Azure Mobile Services

Paul joined Microsoft a little over two years ago to work on WebSockets in .NET 4.5. His current focus is on making it as easy as possible for developers to build backends for their mobile applications.

Leave a Comment
  • Please add 7 and 2 and type the answer here:
  • Post
  • Very exciting news - FYI, as of 7PM EST on 7/26, the file link for the js file results in a file not found error...

  • John, thanks for your comment! The link has been fixed, please try again.

  • To: Visual Studio Team

    Please bring back colour picker in F12 developer tools. Also provide colour picker and colour selector (same as VS2013).

    Thanks.

  • Do you anticipate a second file being published to account for the types used in the API scripts - basically to include new or alternate Request and Response objects, where the Request object provides fields for headers, query, service, user, etc.?  Or would it be better to extend the single file and use an alternate "ApiRequest" member so as to separate the distinct Request objects?

  • Hi dotnetgator,

    We're exploring a few options for handling the different types of scripts in Mobile Services. We have not settled on a particular approach yet but you can be sure that providing intellisense for custom API scripts is on our radar.

    Thanks for your interest!

    Paul

  • That was precisely what I had been looking for. Thanks a ton! Great feature.

  • Another suggestion could be to put this file in the "shared" folder of that service's version control.  To reference that file from the API / table script, the following could be used:

    /// <reference path="..\shared\mobileservices.intellisense.js"/>

Page 1 of 1 (7 items)