4

您可以像这样在命名空间中定义一个类

class Gem
  class SystemExitException
  end
end

或者

class Gem::SystemExitException
end

当代码使用类定义的第一种方法时,ctags 像这样索引类定义:

SystemExitException     test_class.rb   /^  class SystemExitException$/;"      c       class:Gem

使用第二种方式,ctags 像这样索引它:

Gem      rubygems/exceptions.rb  /^class Gem::SystemExitException < SystemExit$/;"       c

第二种方法的问题是,您不能将光标(在 vim 中)放在对“Gem::SystemExitException”的引用上,并直接跳转到类定义。您唯一的办法是翻阅所有以“Gem::”开头的(110 个!)类定义并找到您要查找的类定义。

有谁知道解决方法?也许我应该将此报告给 ctags 的维护者?

4

2 回答 2

3

选项为 --extra=+q,但 ctags 仅支持 C++、Java 和 Eiffel。

http://ctags.sourceforge.net/faq.html#7

所以是的,您必须请求为 Ruby 扩展 +q 模式。

于 2010-04-09T04:48:40.907 回答
2

http://www.mail-archive.com/geany@uvena.de/msg05290.html上有一个修复此行为的补丁

于 2012-12-27T09:24:23.653 回答