1

I've been having some troubles with setting up ctags and vim with a large project I'm new at. The tag files seem to be generating properly (specific options are: --sort=foldcase --recurse --extra=+q --langmap=C++:.C.h.c.cpp.hpp --languages=C++ --c++-kinds=+p --fields=+iaS) and are then loaded into vim - I can see all the tag files with :echo tagfiles(). The problem starts when I try to jump to tags - for some symbols, although they clearly exist within at least one of the tag files, I get the error:

E426: tag not found: specificTagName

The symbol is 100% in one of the tag files (checked with grep and manually - multiple entries for the tag exist, plain name and namespace qualified), the tag files have also been loaded (:echo tagfiles() has the same output as :echo &tags). I'm not sure where to start fixing this as the majority of tags for this project work just fine so this is quite perplexing. Is there a way to look into what goes on after I press '^-]', 'g, ^-]', or ':tag /specificTagName', i.e. debug the search for the tag?

Best regards, drinker

5
  • 1
    One simple test-case would be a 10-line program—generate the tags and see if you're still having problems. Also, search the tags files (e.g., with grep) to make sure you have the tag defined. There are also several tag-related options and functions to check – D. Ben Knoble Sep 4 '20 at 1:24
  • 1
    Also check if you can make it work without passing most of the options you're currently passing it (such as the +q, +p and +iaS), it's possible they might be generating some tag format that Vim doesn't understand... – filbranden Sep 4 '20 at 1:53
  • @D.BenKnoble So I've tried limiting the scope of generated tags to only include the single file where I found the first offending tag. The tag file has therefore been limited to 90 lines instead of around 80000 and has 26 unique symbols. Out of those only a couple work as expected, the others, when you try jumping to them (from the tag file) report the E426 error. This seems extraordinarily weird since all of these tags point to the same file. – drinker Sep 4 '20 at 10:18
  • @filbranden I've tried removing the additional flags one by one and managed to pinpoint the problem to --fields=+S - meaning that the signature in the tag file differs from the actual one. Is that the correct understanding? – drinker Sep 4 '20 at 11:22
  • @drinker If that solved the problem for you, please post that as an answer, including how you got to figure out that seemed to be the problem. Thanks! – filbranden Sep 4 '20 at 14:15
1

The suggestion from @filbranden lead me to check all the the additional flags passed to ctags and when the tags where generated with settings --extra=+q --c++-kinds=+p --fields=+ia then everything worked fine as far as I can tell. The inference being that my problems were caused by --fields=+S - why that is the case is beyond me but the immediate problem seems to be solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.