Currently Exuberant Ctags won't handle JavaScript aliases correctly. Here's some example code:
// A namespace
var mynamespace = {};
// A class within the namespace
mynamespace.o = function(){};
// An alias to the prototype
var _op = mynamespace.o.prototype;
_op.f = function()
{
alert("Hi!");
};
_op = undefined;
// A namespace within a namespace
mynamespace.subnamespace = {};
// An alias for the subnamespace
var _mysub = mynamespace.subnamespace;
_mysub.prop1 = "Hi!";
_mysub = undefined;
It is fairly common to use aliases in these situations since de-referencing can be expensive in JavaScript.
I built the source in svn today and used the following command line:
ctags --format=2 --excmd=pattern --fields=nks --sort=no --language-force=javascript --javascript-types=cfvmp test.js
The resulting tag file looks like:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.6b1 //
mynamespace.o t.js /^mynamespace.o = function(){};$/;" f line:5
_op t.js /^var _op = mynamespace.o.prototype;$/;" v line:8
_op.f t.js /^_op.f = function()$/;" f line:9
_mysub t.js /^var _mysub = mynamespace.subnamespace;$/;" v line:18
The second tag in the list isn't very helpful but doesn't hurt. The third tag I would expect to be "mynamespace.o.f". I also expect to see a tag for mynamespace.subnamespace as well as mynamespace.subnamespace.prop1.
Assigned to maintainer.