universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
326 stars 26 forks source link

Creating Tags File Issue #123

Closed drcxd closed 2 years ago

drcxd commented 2 years ago

Emacs version: 28.1 Platform: Windows Citre package version: 20220406.315 Universal Ctags Version: 5.9; Compiled: Apr 30 2022

So, I am trying to use citre on a simple demo project. By running citre-create-tags-file, I generated an empty tags file.

The following is the recipe I used:

ctags
-o
%TAGSFILE%
--languages=C,C++ ;; programming languages to be scanned
--kinds-all=*
--fields=*
--extras=*
-R
;; add dirs/files to scan here, one line per dir/file
.

Then I got a tag file with the following content:

!_CITRE_CMD ctags|-o|%TAGSFILE%|--languages=C,C++ ;; programming languages to be scanned|--kinds-all=*|--fields=*|--extras=*|-R|.   /command line to generate this tags file/;"
!_TAG_FILE_FORMAT   2   /extended format; --format=1 will not append ;" to lines/;" extras:pseudo
!_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/;"    extras:pseudo
!_TAG_OUTPUT_EXCMD  mixed   /number, pattern, mixed, or combineV2/;"    extras:pseudo
!_TAG_OUTPUT_FILESEP    slash   /slash or backslash/;"  extras:pseudo
!_TAG_OUTPUT_MODE   u-ctags /u-ctags or e-ctags/;"  extras:pseudo
!_TAG_PATTERN_LENGTH_LIMIT  96  /0 for no limit/;"  extras:pseudo
!_TAG_PROC_CWD  E:/workplace/delegate/CppDelegates/ //;"    extras:pseudo
!_TAG_PROGRAM_AUTHOR    Universal Ctags Team    //;"    extras:pseudo
!_TAG_PROGRAM_NAME  Universal Ctags /Derived from Exuberant Ctags/;"    extras:pseudo
!_TAG_PROGRAM_URL   https://ctags.io/   /official site/;"   extras:pseudo
!_TAG_PROGRAM_VERSION   5.9.0   /a7ae1df2/;"    extras:pseudo

If I manually generate the tag file using the command

ctags --languages=c,c++,... --kinds-all='*' --fields='*' --extras='*' -R

citre can works with the generated tag file properly.

AmaiKinono commented 2 years ago

I believe a recent commit fixed this issue. Could you update to the latest version, delete the previously generated tags file, and try again?

chen-chao commented 2 years ago

Hi @drcxd, is the issue gone? I've encountered the same problem. @AmaiKinono could you point me the version that fixed the issue? I'm now using version citre-20220427.1203 in melpa.

AmaiKinono commented 2 years ago

@chen-chao The commit is https://github.com/universal-ctags/citre/commit/87e2cbf3b2ae6d59ec919a2dcb38e56ccfa5ec14. The melpa version you mentioned looks no problem to me.

Could you delete the gemerated tags file and try again?

chen-chao commented 2 years ago

@AmaiKinono, it works after removing the generated tags file. Thank you!

But I encountered another issue (I was indexing chromium project):

ctags.exe: Warning: ignoring null tag in ./base/allocator/partition_allocator/starscan/pcscan_internal.cc(line: 380)
ctags.exe: Warning: ignoring null tag in ./buildtools/third_party/libc++/trunk/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp(line: 90)
ctags.exe: Warning: ignoring null tag in ./components/viz/common/gl_scaler.cc(line: 29)
ctags.exe: failed to truncate the tag file -1 -> -1
 : Invalid argument

It seems a problem in ctags on Windows. Will look at issues in ctags itself.

masatake commented 2 years ago

ctags.exe: failed to truncate the tag file -1 -> -1 : Invalid argument

This looks related to a known bug of ctags.

The generated tags file is too large for the functions used in (ctags and) readtags on Windows.

"Not tagging local variables and parameters" may reduce the size of the tags file. How about append '--kinds-C=-zlD --kinds-C++=-zlD' to the ctags command line like:

ctags
-o
%TAGSFILE%
--languages=C,C++ ;; programming languages to be scanned
--kinds-all=*
--fields=*
--extras=*
--kinds-C=-zlD
--kinds-C++=-zlD
-R
;; add dirs/files to scan here, one line per dir/file
.

I expect that the options will mitigate the issue.

chen-chao commented 2 years ago

Thank you @masatake, it's really helpful. I managed to use citre after reducing the indexing files in chromium.