xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

Jump to symbol #432

Closed drichardson closed 9 years ago

drichardson commented 9 years ago

This is an enhancement request to add the ability to jump to a symbol by name, without necessarily being in a particular source file, similar to ctags and :tag <symbol>. I'm not asking for this to be compatible with :tag (as I understand from reading another Issue that this isn't possible).

drichardson commented 9 years ago

Also, if this ER makes sense, I don't mind doing the work for this, but may need a nudge in the right direction.

drichardson commented 9 years ago

Actually, after investigating this I think I understand why it isn't implemented. libclang works with translation units. In order to provide the functionality I'm talking about, all translation units in the project would have to be constructed (not sure how long that'd take, but it'd at least have to read all the files), whereas clang-complete parses the translation units on demand and then caches them.

Another problem is that you'd need a list of the files in the users project. Perhaps a command like bin/cc_args.py could be used to capture all of the the users files, but that listing would then become a management issue. Another option is to try to parse all files under the directory that contains .clang_complete (if there is one), but that could end up parsing far more files than you're actually interested in (e.g., if you're using clang-complete with the Linux kernel, it'd parse all arch/* files, even though you may only care about one like arch/arm).

drichardson commented 9 years ago

Closing. For my purposes, I think it makes more sense to use clang-complete for command completion, and use ctags for a global index, changing g:clang_jumpto_declaration_key to another key so I can choose between jumping using clang-complete or ctags.