3

考虑这个源片段:

class Z
{
  public:
    Z(int){}
    void foo() {}
};

这按预期工作:

int main()
{
  Z a(1);
  a.        // <- at this point, a list of functions appears in a menu

这根本不起作用:

  Z b       // <- at this point, nothing happens if I press <Tab> or C-X C-U
            // except a "pattern not found" message
  Z b(      // <- same here

但这确实:

  Z b = Z   // a list of constructors appears in a menu when <Tab> is pressed

是否可以设置 clang_complete 使得构造函数完成在两种情况下都有效?

4

1 回答 1

2

这是clang(和libclang)问题,而不是 Vim 的插件clang_complete问题。

clangAFAIK 现在处于积极开发阶段,因此,您可以在http://llvm.org/bugs提交错误报告。但是,我自己在一个多月前提交了几个与代码完成相关的错误(例如这个),但仍然没有解决。

当我需要获取可用的构造函数列表时,我会编写类似你的代码Z b = Z,选择构造函数,然后转换Z b = Z为我真正需要的东西。不是很好,但总比没有好。

于 2013-01-13T16:35:24.333 回答