I am writing some scripts that I broke up into separate files. I am wondering is it possible to get intel开发者_StackOverflow社区lisense working on my custom scripts.
Say I have Script A with some functions that I need to use in Script B. It would be cool if I could see those functions in Script B while I am typing.
I tried to do the xml reference comment
/// <reference path="A.js" />
but this does not seem to do anything.
Thanks
Edit
// script 1
var abc = (function (my, $)
{
my.events = function ()
{
// selectors is from my base file(not shown as I don't think it is needed to be shown)
// my.selectors.createFrm = '#createFrm'
var createSubmitFrmHandler = $(my.selectors.createFrm).live('submit', function (e)
{
e.preventDefault();
});
}
return my;
} abc || {}, jQuery));
// script 2
var abc = (function (my, $)
{
my.dialogs = {
addDialog: function ()
{
var $dialog = $('<div></div>').dialog(
{
width: 580,
height: 410,
resizable: false,
modal: true,
autoOpen: false,
title: 'Basic Dialog',
buttons:
{
Cancel: function ()
{
$(this).dialog('close');
},
'Create': function ()
{
jQuery.validator.unobtrusive.parse(my.selectors.createFrm)
// this is undefined as page loadup no form was found so live did not kick in
my.createSubmitFrmHandler.validate().form();
}
}
});
return $dialog;
},
return my;
} abc || {}, jQuery));
So I have something like that.
If I am in Script 2 if I go to "my." I see nothing in intellisense.
I declare my function in a file (JScript1.js) and add in the intellisense (the comments)
var myFunc = function (myParam) {
/// <summary>
/// This is my summary
/// </summary>
/// <param name="myParam" type="String">
/// This the comment for the parameter
/// </param>
/// <returns type="Array" />
}
I added ///<reference path="JScript1.js"
to the top of my second script (JScript2.js) and intellisense was available.
I moved the file to a different folder, lost intellisense and then updated the path to be the relative path ///<reference path="../Models/JScript1.js"
and intellisense was available again.
精彩评论