你知道 Ruby 的替代 ctags 生成器吗? [英] Do you know an alternative ctags generator for Ruby

查看:49
本文介绍了你知道 Ruby 的替代 ctags 生成器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Exumerant Ctags 不适用于 Ruby,您可以看到 ruby​​.c 代码中有很多 hack,基本上它无法识别许多情况.最重要的一点是:

Exumerant Ctags does not work well with Ruby, you can see there are many hacks in the ruby.c code and basically it fails recognizing many cases. One of the most important is this bit:

class SomeModule::SomeClass
end

Ctags 生成:

SomeModule  someclass.rb  /^class SomeModule::SomeClass$/;"  c

这是错误的.正确且预期的条目是:

which is wrong. The correct and expected entry is:

SomeClass  someclass.rb  /^class SomeModule::SomeClass$/;"  c

这是非常有限的.有一些可用的 ctags 补丁不起作用,例如https://github.com/xtao/overlay/blob/master/dev-util/ctags/files/ctags-5.5.4-ruby-classes.patch 但查看 ctags ruby​​ 代码库,这确实需要完全重写.

This is very limiting. There are some patches for ctags available which does not work, e.g. https://github.com/xtao/overlay/blob/master/dev-util/ctags/files/ctags-5.5.4-ruby-classes.patch but looking on the ctags ruby codebase, this really needs complete rewrite.

所以我一直在玩其他选项,即 https://github.com/rdoc/rdoc-tags哪个效果更好,但速度很慢.我的意思是真的很慢.使用 ctags 在我的项目上生成标签需要 2 秒,但使用此工具需要 1 小时.真的.

So I have been playing with other option which is https://github.com/rdoc/rdoc-tags which works nicer, but it is slow. I mean really SLOW. Generating tags on my project is 2 seconds with ctags but one hour with this tool. Really.

我发现了一个旧项目,它自己解析 Ruby 并生成标签,但它仅适用于 Ruby 1.8.它比 ctags 慢,但还不错.

I found one old project that was parsing Ruby on it's own and generating tags, but it was only for Ruby 1.8. It was slower than ctags, but not that bad.

所以我正在寻找一些替代方案.您是否知道其他任何可以为您提供正确输出并且速度很快的 ruby​​ ctags 生成器?

So I am searching for some alternatives. Do you know about any other working ruby ctags generators which give you proper output and are fast?

谢谢!

编辑:我发现了非常好的项目,它工作 Ruby 1.9+ 并且准确且快速.我推荐它:

Edit: I have found very nice project that works with Ruby 1.9+ and is accurate and fast. I recommend it:

https://github.com/tmm1/ripper-tags

推荐答案

开箱即用的 Exuberant ctags 并没有做很多有用的事情:

Exuberant ctags out of the box doesn’t do a number of useful things:

  • 它不处理:

  • It doesn’t deal with:

module A::B

  • 它不会像‘==’

    不支持限定标签,—type=+

    它不输出常量或属性的标签.

    It doesn’t output tags for constants or attributes.

    补丁可用,但仅适用于 5.5 版本,不再适用.

    Patch available, but it is only for version 5.5 and does not work anymore.

    其他项目:

    • https://github.com/tmm1/ripper-tags (best option for Ruby 1.9+)
    • https://rubygems.org/gems/rdoc-tags (very slow but works with 1.8)

    来源

    这篇关于你知道 Ruby 的替代 ctags 生成器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆