質問

According to the MSDN documentation for the <var> XML Documentation Comment, I should be able to decorate a variable so that the intellisense knows what type the variable is.

It's not working for me. Am I doing this wrong or does the feature not work in this context?

Here's an example where the intellisense works great for bar, but not for foo.

function demo() {
    var A = {
        "AA": function () {
            this.AAA = "1";
        },
        "AB": function () {
            this.ABA = 2;
        }
    };

    function asdf() {
        /// <var type="A">test</var>
        var foo;

        var bar = A;
    }
}

The intellisense for variable bar infers the type from assignment and displays correctly, showing AA and AB.

enter image description here

However, the intellisense for variable foo does not infer the type from the XML comment and does not show AA or AB.

enter image description here

役に立ちましたか?

解決

Resharper doesn't recognize Visual Studio's Javascript IntelliSense comments.

Disable it and it will work fine.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top