Closed phye closed 1 year ago
Not sure what's your set up per ctags.
I'm using counsel-etags which still need some manual setup to enable tags auto-update, https://github.com/redguardtoo/counsel-etags#auto-update-tags-file
My manual set up is in ~/.custom.el
which is not part of this emacs configuration.
I didn't add counsel-etags-virtual-update-tags to after-save-hook. Maybe it's not triggered after buffer save, sometimes when emacs trys to complete things, it just blocks at updating tags.
Try profiling.
Looks block has nothing to do with counsel-etags.
Sure. Will keep updated on getting profiling result.
Confirmed that blocking usually happens whent emacs trying to complete cpp code (after three characters being inserted). Here's the profiling report:
If you need use tags for code completion. try company-ctags
which is much faster.
You can also remove company-capf
from company-backends
or setup company-capf
further.
Thanks!
Will try company-ctags
Confirmed that after removing company-semantic
and company-clang
(which requires proper include header setup which is complicated since I have different include path for searching headers for different projects) from company-backends
and using company-ctags
, blocking disappears.
BTW, do you know if there're any company backends which can parse header search path automatically from CMakelists.txt (hence requires no manual -I
configuration) and use company-clang as the real completion engine? Completing with clang is definitely the best IMHO, however I really dislikes the way to configure header search path...
You can use some lsp client like lsp-mode
or elgot
. They will setup company-mode
and do many other things. If you use lsp, you don't need ctags based solution.
I use a package eacl
which can complete lines by grepping whole project. eacl
is generic tool which could completes #include
statement in C/C++ if the statement already exists somewhere.
Thanks!
I was using lsp-mode
for golang at the moment, perhaps will give lsp-mode
a try.
When you use lsp-mode
, you still can give eacl
a try. Some senior C/C++ developer found it very useful in big projects.
Sure!
Auto updating tags in large project is quite slow and will block editing, hence I need to disable it.
PS1: I've searched several hooks but did not find anything special, not sure what black magic is behind it.
PS2: Setting
counsel-etags-stop-auto-update-tags
to nil will prevent manual generating tags as well (via counsel-etags-update-tags-force), hence I cannot use it.