I'm trying to get proper Intellisense suggestions for my javascript code in Visual Studio Code. In particular, I have the following AngluarJS service:
/// <reference path="definitelytyped/angularjs/angular.d.ts" />
var module = angular.module( 'testApp', [] );
module.factory( 'backend', function ( $http ) {
return {
"getComments": function HoverHereToSeeType( post ) {
/// <summary>Retrieves comments from the backend</summary>
/// <param name="post" type="string">Post to retrieve comments for</param>
return $http.get( "/rest/" + post );
}
};
} )
I thought I should be using XML Documentation Comments, but they don't seem to work - when I hover over HoverHereToSeeType the parameter is shown as "any" (while the return value is properly inferred using angular.d.ts). So the first part of the question is: How do I annotate types in my functions?
The second part of the question comes up when actually trying to use the service:
module.controller( 'MyCtrl', function( backend ) {
backend.getComments( "test" );
} );
I get that IntelliSense doesn't understand Angular's dependency injection, so I'll need to annotate backend's type. But how do I reference that type?
In short: How do I get proper Intellisense for the backend.getComments() call in the second snippet, i.e. the information that the parameter has to be a string and the returned value will be an ng.IHttpPromise?


//**then hit enter?/**, but the important part of the question is how do I structure my comments so Intellisense parses them?