vim-clang icon indicating copy to clipboard operation
vim-clang copied to clipboard

Can add "go to definition" and "go to declaration " ?

Open yuquan23459 opened this issue 11 years ago • 7 comments

It is code completion is very good.But I think if not add "go to definition" and "go to declaration" function in vim-clang.If it has, I think it is better!

yuquan23459 avatar Dec 27 '13 05:12 yuquan23459

@yuquan23459 That's a problem I want to solve~ But that's not a easy problem, as clang driver does not provide these options, so we need to write our own driver based on libclang to do these things.

justmao945 avatar Dec 27 '13 07:12 justmao945

I have used youcompleteme and clang_complete,but they are not good.Clang_complete only can "goto declaration",and youcompleteme must include .cpp file so that can "goto definition",else if only can "goto declaration". In the way to "goto definition", sublimeclang is the best of all use clang plugin.But sublimeclang is sublime text 2 plugin.I think you can reference it.

yuquan23459 avatar Jan 05 '14 08:01 yuquan23459

@yuquan23459 yeah, I will try it. Now I am studying the clang index interface, but I am not sure when would the first version of clangd come out…Generally, I am familiar with the project source code, so I almost will not see the definition or somewhat. But this is really very nice for reading source code of some unfamiliar project-_-b

justmao945 avatar Jan 05 '14 14:01 justmao945

sublimeclang use libclang. It's no easy to use libclang...

syswow avatar Apr 30 '15 14:04 syswow

Check funtion clang_getExpansionLocation:

http://clang.llvm.org/doxygen/group__CINDEX__LOCATIONS.html#gadee4bea0fa34550663e869f48550eb1f

makiolo avatar Jan 11 '16 11:01 makiolo

These plugin will probably be a good reference for this isssue :smiley: https://github.com/libclang-vim/libclang-vim https://github.com/osyo-manga/vim-snowdrop

yutkat avatar Oct 17 '16 15:10 yutkat

If you see Readme, this plugin doesn't use libclang on purpose. Ctags works more or less, it gets messy for cpp overloaded craps, but a good lightweight solution. Indeed, it'd be a nice feature, but even Clion doesn't sometimes get this right. Not entirely related, but for finding usages, you need cscope as well, so mixing plugins are inevitable in many cases.

So I suggest closing this issue, also considering the age of it. Just add it in readme that jumping to definition/declaration won't be supported.

smekkley avatar Sep 20 '20 07:09 smekkley