Closed yoacompsci closed 4 years ago
You need input at least first 3 characters of method name. It's based on cli program ctags
. Ctags can't find which method belongs to which class.
So company-ctags
is just code completion. It's does not provide intellisense.
I used be C++ developer. Intellisense is actually not very useful for senior developers working in big projects. Simple and fast code completion is good enough.
You can check my another project eacl https://github.com/redguardtoo/eacl if you want more completions. eacl is base on my observation that the code snippet you need write is often already written by other team members. So eacl can grep single line or multi-line to auto-complete code snippet.
Hello Chen, I will have a look to the ‘eacl’ package. I have read 'universal-ctags' docu. about the issue of parsing members variables and functions in C++. Thanks!
Hi Chen!
I want to set-up ‘company-ctags’ for code-completion and ‘counsel-etags’ for code navigation in C++. I use your ‘emacs.d’ and I have installed both packages. Additionally checked in terminal Universal Ctags installed.
Making some test in C++ with ‘company-ctags’ package, I made ‘company-ctags’ auto-complete happens over my own objects created and defined in a simple test file, named ‘test.cpp’.
However it doesn’t work with the system headers implementations included in the test file, I mean for example:
#include <vector>
using namespace std;
struct foo {
int Val1;
float Val2;
};
int main() {
foo f1;
f1.Val1 = 1; // OK, completions happens.
vector<int> v1; // v1.???? no completions…
v1.
}
Member functions (assign, at, empty, ...) from the STL #include header file included in the ‘test.cpp’ are not shown at completion point.
I have installed and configured counsel-etags and company-ctags following the indications: ` ;;-------------------------------------------------------------- (setq tags-revert-without-query t) (setq large-file-warning-threshold nil) (setq counsel-etags-update-interval 180) (add-hook 'prog-mode-hook (lambda () (add-hook 'after-save-hook 'counsel-etags-virtual-update-tags 'append 'local)))
(global-set-key (kbd "M-,") 'counsel-etags-find-tag-at-point) (global-set-key (kbd "M-t") 'counsel-etags-grep-symbol-at-point) (global-set-key (kbd "M-s") 'counsel-etags-find-tag)
(setq counsel-etags-extra-tags-files '("d:/tt_tools/MinGW/distro/16_0/include/c++/8.1.0/TAGS")) ;;-------------------------------------------------------------- (eval-after-load 'company '(progn (require 'company-ctags) (company-ctags-auto-setup)))
(setq company-ctags-extra-tags-files '("d:/tt_tools/MinGW/distro/16_0/include/c++/8.1.0/TAGS")) ;;-------------------------------------------------------------- ` The extra TAGS file was created using universal-ctags with the command:
ctags.exe -Re --language-force=c++ -h=\".h.H.hh.hpp.hxx.h++.inc.def.\" --c++-kinds=+p+l --fields=+iaS --extras=+q d:\tt_tools\MinGW\distro\16_0\include\c++\8.1.0
The TAGS file related with the test.cpp is created according to the setup of the counsel-etags.el variable:
(defcustom counsel-etags-tags-program "d:\\tt_tools\\cygwin\\cygwin64\\bin\\ctags.exe -Re --language-force=c++ -h=\".h.H.hh.hpp.hxx.h++.inc.def.\" --c++-kinds=+p+l --fields=+iaS --extras=+q" :group 'counsel-etags :type 'string)
The additional variables: “defcustom counsel-etags-find-program” and “defcustom counsel-etags-grep-program”. Also have been adjusted to the installed path locations of the programs.
With that configuration, I try “counsel-etags-find-tag-at-point” command over STL methods, for example, at v1.empace_back(42); and properly finds the implementation of the emplace_back() method. With that result, I created another header file named ‘test.h’ in the same directory with additional data structure:
struct bar { int Val3; float Val4; };
included that header file in the ‘test.cpp’ and immediately completions and find-tag-at-point works properly over my own structures.The auto-completions of the STL headers doesn’t work with my configuration. Would be great to have that feature editing C++ code since I consider it one of the most useful feature.
Do you know what could happen?
Thanks!