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

This issue is still not fixed until now. Both on my Win10 and Ubuntu platform.

RogerPanBUAAedu avatar May 21 '19 07:05 RogerPanBUAAedu

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

I find a solution, install and run "gtags" in your project folder, after "GPATH", "GRTAGS", "GTAGS" files are created in your folder, your "peek references" function will work normally.

robotwxy avatar May 23 '19 03:05 robotwxy

Really looking forward to it!!!

liushiqi9 avatar May 23 '19 05:05 liushiqi9

Looking forward to it, too. But if you are super eager to use "Find all references" right now you can just install scope4code. It's very easy and works immediately without any configuration (except installing cscope by a single line of sudo apt-get install cscope).

zcgeng avatar May 26 '19 19:05 zcgeng

please install C++ Intellisense extention it has been solved

you also have to install gnu-global,And run command “gtags” in the root of project.

  1. download: http://adoxa.altervista.org/global/
  2. add /bin to your PATH
  3. run command "gtags" in the root of project.

image

image

image

jiayuqicz avatar Jun 06 '19 02:06 jiayuqicz

please install C++ Intellisense extention it has been solved

shift+F12 still not working for me with intellisense?

fsaizwei avatar Jun 06 '19 04:06 fsaizwei

please install C++ Intellisense extention it has been solved

shift+F12 still not working for me with intellisense?

me either

windless0530 avatar Jun 06 '19 08:06 windless0530

Eager to use this feature. This is the only issue that stops me from switching to Code from CLion.

windless0530 avatar Jun 06 '19 08:06 windless0530

please install C++ Intellisense extention it has been solved

I don't think so

leosdad avatar Jun 08 '19 16:06 leosdad

please install C++ Intellisense extention it has been solved

shift+F12 still not working for me with intellisense?

you also have to install gnu-global,And run command “gtags” in the root of project.

  1. download: http://adoxa.altervista.org/global/
  2. add /bin to your PATH
  3. run command "gtags" in the root of project.

image

jiayuqicz avatar Jun 14 '19 16:06 jiayuqicz

We're getting closer to having a preview available for this feature. However, it doesn't look like it will be ready in time for our current release. We plan to have it ready for Insiders in the first half of July. Thank you for your patience and understanding.

bobbrow avatar Jun 14 '19 20:06 bobbrow

please install C++ Intellisense extention it has been solved

shift+F12 still not working for me with intellisense?

you also have to install gnu-global,And run command “gtags” in the root of project.

  1. download: http://adoxa.altervista.org/global/
  2. add /bin to your PATH
  3. run command "gtags" in the root of project.

image

I installed Global (apt install) version 6.6.2 and ran gtags, the GPATH, GRTAGS, GTAGS files were created, restarted VSCode but still 'Find All References' doesn't work. Can you tell me what I'm missing? Thanks

Alonzzzo2 avatar Jun 25 '19 15:06 Alonzzzo2

@jiayuqicz what platform do you use, windows or Linux?

CanCanZeng avatar Jul 01 '19 16:07 CanCanZeng

@jiayuqicz what platform do you use, windows or Linux?

windows

jiayuqicz avatar Jul 02 '19 14:07 jiayuqicz

please install C++ Intellisense extention it has been solved

shift+F12 still not working for me with intellisense?

you also have to install gnu-global,And run command “gtags” in the root of project.

  1. download: http://adoxa.altervista.org/global/
  2. add /bin to your PATH
  3. run command "gtags" in the root of project.

image

I installed Global (apt install) version 6.6.2 and ran gtags, the GPATH, GRTAGS, GTAGS files were created, restarted VSCode but still 'Find All References' doesn't work. Can you tell me what I'm missing? Thanks

eh…,I don't know,it just work on my computer. maybe you can try to read the instruction of the extention and try again

jiayuqicz avatar Jul 02 '19 14:07 jiayuqicz

@sean-mcmanus when this feature is finished, I hope cpptools can support this commands: getReferencesCommand. When I pass file uri, line and column as parameters of this command, it can return all references location to me regardless of this file is opened or not. Could you add this feature to "Find all references" for me ?

Lennon925 avatar Jul 05 '19 08:07 Lennon925

Until this is ready, I have things working pretty well with the vscode-clangd extension and this extension both enabled. Here are the key things you need to add to your settings:

    "C_Cpp.autocomplete": "Disabled",  // So you don't get autocomplete from both extensions.
    "C_Cpp.errorSquiggles": "Disabled", // So you don't get error squiggles from both extensions (clangd's seem to be more reliable anyway).
    "clangd.path": "/usr/local/opt/llvm/bin/clangd", // Path to clangd. Note it might be clangd-8 on Linux. Also you need version 8 at least.
    "clangd.arguments": [
        "-background-index" // So Find All References actually works properly.
    ],
    // Don't disable the intellisense engine otherwise switch header/source (Alt-O) doesn't work.

Also I then symlink compile_commands.json from my source directory to the build directory.

It is a little flaky. Sometimes clangd seems to get stuck and I have to reload the window. Also while error squiggles, Find All Reference, and Go To Definition work pretty reliably, Find Symbol doesn't. Still I think it is the best option until this extension supports it properly.

Timmmm avatar Jul 05 '19 10:07 Timmmm

To add to what @Timmmm said, note that --background-index was introduced in clangd-8. I found out the hard way that clangd-7 doesn't expect that argument, and the completion server will crash inside of vscode with no indication of why (I had to write a wrapper script that redirected stderr/stdout to a file to inspect later in order to find out what was going on).

cstrahan avatar Jul 11 '19 16:07 cstrahan

We're getting closer to having a preview available for this feature. However, it doesn't look like it will be ready in time for our current release. We plan to have it ready for Insiders in the first half of July. Thank you for your patience and understanding.

Is this implementation going to work without requiring installation of external tools? It's hard for me to get tools, and Eclipse CDT provides this feature without them.

HunterZ avatar Jul 16 '19 15:07 HunterZ

Is this implementation going to work without requiring installation of external tools? It's hard for me to get tools, and Eclipse CDT provides this feature without them.

:). Yes, indexing has been a core feature of CDT since the beginning. It's hard to do right enough and fast enough so I appreciate the time cpptools is taking to get there.

dschaefer avatar Jul 16 '19 15:07 dschaefer