开发者

Navigate OO JS code

开发者 https://www.devze.com 2023-02-20 02:04 出处:网络
I do a lot of JavaScript editing, and now with Node becoming a popular server-side scripting language I can see myself using even more JS than ever. The problem I have is finding a way to navigate lar

I do a lot of JavaScript editing, and now with Node becoming a popular server-side scripting language I can see myself using even more JS than ever. The problem I have is finding a way to navigate large amounts of Object Oriented JavaScript code.

TextMate has a way to view "symbols" but it's a flat structure that I don't find very useful. Vim has TagList but I can't seem to get it to work very well with JS. Sublime Text can search through functions very well, but again, it's a flat list.

BBEdit lists functions hierarchically, which is awesome, but the list is usually really long since you cannot collapse/f开发者_Python百科old the list.

Aptana and NetBeans have a nice outline viewer, which are about as close to perfect as I've been able to find: Hierarchical layout, search filter, folding, sorting options, etc.. My only problem with both is that they're a bit slow (at least to load), and they only show functions within an open file (not within a project).

My ideal solution would be some kind of standalone app that could be opened with a hot key. You could then see a list of all your functions inside all your files (in a project), filter the list using a search string, and then when you find the function you're after open it in your favorite editor.

In other words, I'd like to navigate by objects rather than file structure. Is this possible?

I use a Mac primarily, but I'd also be interested in hearing about solutions for Windows.

Thanks in advance for your help.


You want Mozilla's jsctags, built expressly for this purpose. You can use it with (e.g.) Tagbar or taglist-plus.


You could check WebStorm ( http://www.jetbrains.com/webstorm/ ) - I've switched to it few months ago, and it's definitely the best IDE for JS right now. It has a nice outline too, understands JS pretty well, and is fast.


Sorry for the plug, but I'm the author of Tagbar and thought it would be helpful to mention that I just added support for jsctags (and potentially other compatible programs) to it. If jsctags is in your $PATH it should just work out-of-the-box, otherwise the documentation should provide you with all needed information. Let me know if you find any problems!


In Eclipse, opening a JS file with "JavaScript Editor" gives you a rather nice outline which can be navigated with the keyboard: the arrows do what the arrows normally do and you can hit a to go to the next member starting with a.

The whole thing is quite slow on my own (old) G5 but it's OK on the MacPro I have at work.

0

精彩评论

暂无评论...
验证码 换一张
取 消