5

I'm using VS2012, and one of my project-wide Javascript function namespaces has all of its exposed methods beginning with underscores _, for example:

var NameSpace = {
    _aMethod = function () { },
    _anotherMethod = function () { }
};

I created a quick vsdoc file for the namespace, and the namespace itself appears, but none of the methods do. NOTE: If I remove the _ at the beginning of the methods, it works like a charm.

// This would work, and show up in the VSDOC
var NameSpace = {
    aMethod = function () { },
    anotherMethod = function () { }
 // ^ notice no underscores
};

Is there anyway around this?

Going through the entire project and renaming them (even with a find-all) would be risky since these methods are so intertwined with everything.

Mark Pieszak - Trilon.io
  • 44,537
  • 13
  • 74
  • 89

1 Answers1

4

If you go into Tools->Options->Text Editor->JavaScript->IntelliSense->References there should be a drop down for the reference group (depending on what type of project you may need to change this)

Once you have the right group you'll noticed there are some default included intellisense reference files. Try removing the underscorefilter.js

Bryan
  • 56
  • 1
  • Doesn't seem to work in VS2013. Removed the file, underscored methods still aren't appearing. Tried closing and reopening the file afterwards, even tried restarting VS, but no success. – andrewb Jun 19 '15 at 03:29
  • 1
    The reason for it is to "fake" underscored properties as private properties. When calling from "outside", the underscore are hidden. When calling an internal property with the "this.", you see the underscored variables. By chance, we can disable it if we want, thanks to @bryan response. [Other thread about it](http://stackoverflow.com/questions/4484424/underscore-prefix-for-property-and-method-names-in-javascript) – foxontherock Dec 17 '15 at 19:34