universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.57k stars 628 forks source link

[question, documentation] how to include subdirectories foo.lib or bar.so #3076

Open XSven opened 3 years ago

XSven commented 3 years ago

I have to maintain a C, C++ source code project.

When I am recursively indexing the files, all files located in subdirectories that have (strangely of course) names ending with .lib or .so are ignored. Yes it is the subdirectory name that ends with .lib or .so!

My guess is that this behaviour has something to do with the *.lib and *.so entries in --list-excludes.

Although I have read the documentation carefully I haven't found any way to include these kind subdirectories. I have tried to use --exclude-exception but because I am not explicitly --exclude a pattern this procedure does not work for me.

Any help would be very much appreciated and maybe the documentation could consider this use case too.

masatake commented 3 years ago

I have just found a bug in --exclude-exception. But following command line may work even with the bug.

There are two ways.

A. resetting the exclusion list:

$ mkdir -p src/mylib.so
$ echo 'int main(void) { return 0; }' > src/mylib.so/foo.c
$ ./ctags --options=NONE -R -o - src
ctags: Notice: No options will be read from files or environment
$ ./ctags --options=NONE --exclude= -R -o - src
ctags: Notice: No options will be read from files or environment
main    src/mylib.so/foo.c  /^int main(void) { return 0; }$/;"  f   typeref:typename:int

B. using --exclude-exception

./ctags --verbose --options=NONE --exclude-exception='*.so' -R -o - src

Because of the bug, you can specify any string instead of *.so to get the same result.