vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Find all references (Experimental Version)

Open csholmq opened this issue 10 years ago • 96 comments

Would be great to have Find all references working. Huge helper in large projects.

csholmq avatar Apr 17 '16 16:04 csholmq

@osemmler you can use ccls extension instead of this one, it has support for this

https://github.com/MaskRay/vscode-ccls

Yanpas avatar Feb 15 '19 10:02 Yanpas

I have the "Find All References" in my context menu, but it always produces "No results found" even if there is references in the same file. Disappointing!

martinakos avatar Feb 26 '19 14:02 martinakos

@martinakos Our extension does not add "Find All References" to the context menu. I think another C/C++ extension must be adding it. But either way, we haven't finished implementing it yet.

sean-mcmanus avatar Feb 26 '19 22:02 sean-mcmanus

Except to support the c/c++ , really love this plugin's idea and deeply need this.

WoolenWang avatar Mar 03 '19 13:03 WoolenWang

The command "Change all occurrences" highlights all occurrences in the same file in the scroll area, which can be helpful. However I also find this to be the most needed feature in the C/C++ extension.

leosdad avatar Mar 03 '19 18:03 leosdad

@martinakos Our extension does not add "Find All References" to the context menu. I think another C/C++ extension must be adding it. But either way, we haven't finished implementing it yet.

I think It's added by the VS Code

Jekton avatar Mar 20 '19 11:03 Jekton

@Jekton It's added by VS Code only when an extension reports that they support the "referenceProvider" capability which our extension reports "false".

sean-mcmanus avatar Mar 20 '19 21:03 sean-mcmanus

@martinakos Some extension like cquery or C++ Intellisense can add the Find all references to right click menu but doesn't relate to VS Code API. They have even added the functionality for years, rely on gtag or so.

LeThiHyVong avatar Mar 21 '19 00:03 LeThiHyVong

3 years ago: issue created.

A year later, 2 years ago:

@sean-mcmanus: We don't use cscope or ctags and are not planning to. We expect the IntelliSense implementation to work.

Two more years later, now:

either way, we haven't finished implementing it yet

I think I will just continue using vim+cscope. VSCode without 'Find all references' is useless for C/C++ projects, and at this pace it looks like it will never become usable.

AlexanderAmelkin avatar Mar 29 '19 11:03 AlexanderAmelkin

Tip: Just install the vscode-clangd extension (supports renaming too) and set "C_Cpp.intelliSenseEngine": "Disabled", so you can keep using cpptools for debugging.

Get the clangd binary from LLVM: https://llvm.org/builds/

edit: You need a build system, that generates compile_commands.json like cmake or meson, to make this work and adjust settings.json:

    "C_Cpp.intelliSenseEngine": "Disabled",
    "clangd.arguments": [
        "-compile-commands-dir=build"
    ],
    "cmake.configureSettings": {
        "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
    },

eszlari avatar Apr 01 '19 06:04 eszlari

@AlexanderAmelkin As my predecessor said, try using clangd with its extension. I have "configured" it few days ago and it works quite well, of course you have to disable this microsoft addon, and allow clangd do the stuff ;)

XobSod avatar Apr 01 '19 09:04 XobSod

So vscode-cpptools is actually the best plugin for and only for cpp debugging, lesson learned.

starship863 avatar Apr 03 '19 02:04 starship863

I installed clang/clangd with the following command in my msys2.

pacman -S mingw-w64-i686-llvm mingw-w64-i686-clang mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra

liudonghua123 avatar Apr 03 '19 04:04 liudonghua123

I tried clangd with the above mentioned way, but it seemed less effective. Maybe this is because of the cmake-tools extension, but the intellisense wasn't working properly. I suspect this is my fault, so I do not say don't try this, although it can be true the other way around. When I use the cpptools with cmake-tools it works really nicely, except the rename feature of course.

csorvagep avatar Apr 05 '19 09:04 csorvagep

@csorvagep I updated my comment with full instructions!

eszlari avatar Apr 05 '19 10:04 eszlari

@eszlari, Thanks for your help, but it still not works properly. I created an example project for this and used cairo which worked but give me no intellisense at all. I also tried Eigen, but it showed 'file not found' for the include and there was squiggly line under every Eigen namespace. After that I created a test class, but it gave me the same error.

I checked the generated compile_commands.json and it should be fine. The log showed me nothing useful about this. Any ideas? I tried this on windows with mingw, but it should be the same for other systems.

Ps: Sorry if it's a little bit off topic.

csorvagep avatar Apr 08 '19 07:04 csorvagep

used cairo which worked but give me no intellisense at all.

cairo's build system doesn't generate a compile_commands.json.

I also tried Eigen, but it showed 'file not found' for the include and there was squiggly line under every Eigen namespace.

I also couldn't get Eigen to work, but other sources worked, e.g. try libgit2.

eszlari avatar Apr 09 '19 04:04 eszlari

when choose menu "Find All References", it always show "no results found." when will add this feature offical.

ranqiyu avatar Apr 22 '19 10:04 ranqiyu

Really looking forward to June release - this is a killer feature!

mmcru avatar Apr 23 '19 16:04 mmcru

I am also waiting for this feature... My current setup is already quite complex, and installing some "non-official" additional programs is not manageable with simple scripts, that set's up the environment... Let's hope to see it in June :)

msandor93 avatar May 07 '19 09:05 msandor93