Vim c++ indexing that differentiates between symbols with same names

87 views Asked by At

I've been trying out vim with exuberant tags and cscope but when listing the usages of a variable it also lists variables with the same name that aren't really the symbol I'm looking at. For example if I want to jump to the declaration or other usages of a variable called "temp", it will give me all variables called "temp" in the whole repo. Am I using tags and cscope wrong or is there another plugin I should be using instead?

1

There are 1 answers

0
romainl On

Ctags and cscope use parsers and even regular expressions to find symbols in files. They "understand" syntax, in a way, but they don't understand code so they have no idea about what specific function is called where.

Consequently…

  • that relationship is not encoded in the resulting database,
  • and it is lost to any program using ctags or cscope.

If you want a tool that knows exactly which temp is referenced, then you don't want csope or ctags. You want something based on a compiler, like clang.