有没有更好的 ctags 替代品? [英] Is there an alternative to ctags that works better?

查看:50
本文介绍了有没有更好的 ctags 替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了 vim 的 taglist 插件,并阅读了如何将它与 ctags 一起使用.

I have just discovered the taglist plugin for vim, and read about how to use it with ctags.

然而,令人失望的是 ctags 是一个非常简单的解析器.

However, disappointingly ctags is a very simple parser.

有没有更完整的替代方案?

Is there an alternative that is more complete?

特别是我正在寻找的东西:

Specifically I'm looking for something that:

  • 扩展 #define(x, y) x ## y 样式宏用于函数声明

处理#include 语句

允许为依赖项指定包含路径

allows include paths to be specified for dependencies

我看到 clang 提供了一个用于访问 c AST 的编程 api,所以这肯定不是很难做到吗?

I see that clang provides a programatic api for accessing the c AST, so surely this isn't terribly hard to do?

有人已经做过了吗?

--

这些没有削减它:

  • clang_indexer - 无法编译;当它起作用时(黑客攻击后),不起作用(无尽的错误).

  • clang_indexer - Doesn't compile; when it does (after hacking), doesn't work (endless errors).

clang_complete - 似乎并不比 ctags 好.没有上下文特定的建议,没有结构完成,没有函数参数,没有宏扩展;只是一个符号列表和它们来自的文件.

clang_complete - Doesn't seem any better than ctags. No context specific recommendations, no struct completion, no function arguments, no macro expansion; just a list of symbols and the file they came from.

推荐答案

我自己也花了很多时间来解决这个问题.

I've spent quite some time struggling with this myself.

我得到的最接近的是一种叫做 gccsense 的东西.不幸的是,该项目似乎被放弃了,而且由于英语不是作者的第一语言,因此设置起来很困难.

The closest I ever got was something called gccsense. Unfortunately, the project seems abandoned and moreover it was difficult setting it up because English was not the author's first language.

我最终从另一个角度解决了这个问题.我决定智能感知/自动完成对我的编码比拥有 vim 的所有可用功能更重要,所以我选择了像 Eclipse 这样的 IDE,然后找到了一个模拟 Vim 的 Eclipse 插件.到目前为止,我发现的最好的插件是可行.

I ended up approaching the problem from another angle. I made the decision that intellisense/autocomplete was more important to my coding than having all the available features of vim, so I chose an IDE like Eclipse, and then found a plugin for Eclipse that emulates Vim. So far the best kind of plugin like that that I found was Viable.

以下是我尝试过但不满意的选项的完整列表:

Here is the full list of options that I have tried and found unsatisfactory:

  • clang - 要求您从 gcc 切换到不同的更好"的编译器.问题是 gcc 更加成熟 [edit 显然您不需要切换编译器,请参阅下面的评论,我将来可能会再试一次.]
  • gccsense - 好主意(使用 gcc 为您提供代码补全)但是该项目的工作被放弃了 :( 并且该版本是测试版质量
  • xref in vim - 外部参照是一个很棒的独立工具,非常适合解析C. 可以使用 vxref 在 vi​​m 中工作,但是根据我的经验,外部参照缺乏解析当前的 C++ 代码并停止对其进行开发(以及在 vxref 上的开发.)
  • eclim - 似乎非常适合使用 eclipse 的 Java 支持,在解析 C++ 或 C 代码时速度极慢且完全不可靠.通常发生的情况是一切正常运行很长时间,但突然间,解析器停止解析您编写的任何新代码,除了加载 eclipse 本身并强制 eclipse 重新解析项目似乎有所帮助.此外,这不是一个重要的事实,但更令人烦恼的是 eclim 接管了错误处理,因此它破坏了 vim 通常从 gcc 解析错误的方式,这意味着您无法访问令人讨厌的 quickfix 列表.
  • netbeans + jvi - 很多人对此发誓,但我对 jvi 有各种各样的问题.我遇到的一个主要问题是 jvi 会说我处于正常模式,但实际上处于插入模式,只有重新启动才会有所帮助.
  • eclipse + viplugin/vrapper - 这看起来是最好的选择;每个都有自己的一组错误 + 缺乏功能,但仍然是最有吸引力的,直到我发现可行的似乎是最稳定且功能最多的.
  • clang - requires you switch from gcc to a different and "better" compiler. The problem is gcc is much more mature [edit apparently you don't need to switch compilers see comments below, I may give this another try in the future.]
  • gccsense - great idea (using gcc to give you the code completion) however work on the project is abandoned :( and the version that is up is beta quality
  • xref in vim - xref is a great standalone tool and works great for parsing C. It can be made to work in vim with vxref, however from my experience xref lacks in parsing current C++ code and development on it has stopped (as well as development on vxref.)
  • eclim - seems to work great for Java support using eclipse, extremely slow and completely unreliable when parsing C++ or C code. What usually happens is everything works for a long while, but then suddenly, the parser stops parsing any new code that you write, and nothing short of loading up eclipse itself and forcing eclipse to reparse the project seems to help. Also, less of an important fact, but more of an annoyance is that eclim takes over handling errors, so it screws up the way vim usually parses errors from gcc meaning you have no access to the quickfix list which is annoying.
  • netbeans + jvi - alot of people swear by this, but I had all sorts of problems with jvi. One major problem I had was jvi would say I'm in normal mode, but really was in insert mode, nothing short of a restart would help.
  • eclipse + viplugin/vrapper - this was beginning to look like the best option; each had its own set of bugs + lacking features, but still was most attractive, until I found viable which seemed to be the most stable and have the most features.

如果您确实找到了满意的解决方案,请在评论中分享,因为我会对它感兴趣.

If you do find a solution you are happy with please share it in a comment, because I would be interested in it.

这篇关于有没有更好的 ctags 替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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