Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ auto-complete #961

Open
Zexin-Li opened this issue Jan 21, 2022 · 1 comment
Open

C/C++ auto-complete #961

Zexin-Li opened this issue Jan 21, 2022 · 1 comment

Comments

@Zexin-Li
Copy link

我用了该emacs配置默认没修改版本,我也安装了clang、cmake、clangd、gtags、universal-ctags 作为backend,C++补全在单个文件没问题。
但是在项目中使用遇到了问题,以leveldb为例,我用universal-ctags在leveldb/目录下ctags -e -R .生成了TAGS文件,或者通过counsel-etags-scan-code添加TAGS文件,但是company-mode给我的补全提示不太稳定,有时候不提示,有时候提示了一些不相关的,如下图
1
2
3
4
5
是我使用方式有问题吗:比如哪里得添加配置

@redguardtoo
Copy link
Owner

redguardtoo commented Jan 21, 2022

自动完成是由company-mode提供UI的。自动完成候选项由对应特定命令行工具的backend提供,见company-backends.
我只用ctags。所以对应的backendcompany-ctags. 它很稳定,如果没有你想要的候选项,可能是因为我把ctags扫描代码生成TAGS文件的时间间隔设置的比你预期的长。counsel-etags-update-interval的默认值是300秒。company-ctags定期载入的TAGS文件的时间间隔定义在company-ctags-check-tags-file-interval,默认是30秒。

这样设置的目的是为了获得最佳编辑体验。减少内存和CPU消耗。对自动完成的实时性做了一点妥协。但我同时用hippie-expandeacl两个插件做补充。

如果你使用其他命令行工具特别是LSP系列的自动完成backend。实时性很高,语义分析更准确,内存和CPU消耗就差很多了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants