What to do to get javascript intellisense for my own js library in Visual Studio

I have several javascript files and they have their own functions. If I make a link to one of them inside any of them, she will not see her function if the function is not a prototype. What is the logic inside Intellisense?

I want to use the Splash function with the Intellisense function below, how can I do this?

//My.js
/// <reference path="Test.js" />

.

//Test.js
NameSpace.prototype.UI = new function () {

    this.Splash = function (value) {
        try {
            if (value == 1) {
                $('#splash').css('height', $(document).height());
                $('#splashContent').css('top', $(window).height() / 2);
                $('#splash').fadeIn();
                $('#splashContent').fadeIn();
                setTimeout("SF.UI.Splash(0)", 3000);
            }
            else if (value == 0) {
                $('#splash').fadeOut(1000);
                $('#splashContent').fadeOut(1000);
            }
            else if (value == 3) {
                $('#splash').css('height', $(document).height());
                $('#splashContent').css('top', $(window).height() / 2);
                $('#splash').fadeIn();
                $('#splashContent').fadeIn();
            }
        } catch (e) {
            Splash(0);
        }
    }
}
+2
source share
2 answers

JS Intellisense is peeling at best. Despite all these articles, in my experience, it does not work as advertised. I would suggest:

  • Make sure that all your JS files are in the same project (which makes work between projects even more difficult).
  • , /// <reference path="Test.js" /> - JS.
  • , Test.js ( JSLint ) vsdoc.
  • Output, , - , intellisense. JS , .

Test-vsdoc.js ( , JS , intellisense):

//Test-vsdoc.js
NameSpace.prototype.UI = new function () {

    this.Splash = function (value) {
    /// <summary>This is my function summary</summary>
    }
}

VS , IDE ( Ctrl + Shift + J)

+3

, js , //My.js, .

/// <reference , .

, , ? ref, tab tab. .

, , VS2010 js, Ctrl + Shift + J .js

+1

Source: https://habr.com/ru/post/1796057/


All Articles