导航 OO JS 代码

发布于 2024-10-26 21:56:54 字数 737 浏览 4 评论 0原文

我进行了大量的 JavaScript 编辑,现在随着 Node 成为一种流行的服务器端脚本语言,我可以看到自己使用的 JS 比以往任何时候都多。我遇到的问题是找到一种方法来导航大量面向对象的 JavaScript 代码。

TextMate 有一种查看“符号”的方法,但它是一种平面结构,我觉得不是很有用。 Vim 有 TagList 但我似乎无法让它与 JS 很好地配合。 Sublime Text 可以很好地搜索函数,但同样,它是一个平面列表。

BBEdit 按层次列出函数,这很棒,但列表通常很长,因为您无法折叠/折叠列表。

AptanaNetBeans 有一个很好的大纲查看器,这是我能找到的最接近完美的:分层布局、搜索过滤器、折叠、排序选项,等等..我对两者的唯一问题是它们有点慢(至少加载),并且它们只显示打开文件中的函数(而不是项目中的函数)。

我理想的解决方案是某种可以用热键打开的独立应用程序。然后,您可以在所有文件(项目中)中看到所有函数的列表,使用搜索字符串过滤列表,然后当您找到要查找的函数时,在您最喜欢的编辑器中将其打开。

换句话说,我想通过对象而不是文件结构进行导航。这可能吗?

我主要使用 Mac,但我也有兴趣了解针对 Windows 的解决方案。

预先感谢您的帮助。

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/fold 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萝莉病 2024-11-02 21:56:54

您需要 Mozilla 专门为此目的构建的 jsctags。您可以将其与(例如) Tagbartaglist-plus

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

何止钟意 2024-11-02 21:56:54

您可以检查 WebStorm ( http://www.jetbrains.com/webstorm/ ) - 我已经几个月前改用它,它绝对是目前 JS 最好的 IDE。它也有一个很好的轮廓,很好地理解 JS,而且速度很快。

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.

罗罗贝儿 2024-11-02 21:56:54

抱歉这个插件,但我是 Tagbar 的作者,并且认为提及这一点会有所帮助我刚刚添加了对 jsctags(以及可能的其他兼容程序)的支持。如果 jsctags 在您的 $PATH 中,它应该开箱即用,否则文档应该为您提供所有需要的信息。如果您发现任何问题,请告诉我!

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!

染墨丶若流云 2024-11-02 21:56:54

在 Eclipse 中,使用“JavaScript 编辑器”打开 JS 文件会为您提供一个相当漂亮的轮廓,可以使用键盘进行导航:箭头执行箭头通常执行的操作,您可以按 a 转到下一个以 a 开头的成员。

在我自己的(旧的)G5 上,整个过程相当慢,但在我工作的 MacPro 上却没问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文