Skip to content

Find All References doesn't return all instances at first but Find in Files does #67962

Closed

Description

Issue Type: Bug

I have doing Find All References (FAR) from the definition of a function in JS. It shows me the definition and sometimes one reference almost as if it's only showing me the instances in my open files.

However I can do Find In Files (FIF) and see there are more as I expected. Once I open one of those instance that were not previously found, not Find All References does find them all, even ones in files I didn't open.

Just now I found the definition only with FAR, but once I did FIF and opened one of them (a reducer file in React), then did FAR from that instance (so not the definition), then it did find all the references including the reducer I just started from, the definition it was already finding, and now also the action file that also contained a reference. I went back to the definition of the function and did FAR again and it does still find all of them indeed now. Note that I never opened the action file so it's not about just finding the references in the open files. In other words, when it kicks into working, it does find the references even in non-open files.

My project is this: https://github.com/jodymbrooks/brave
and I am doing FAR and FIF for getCardFromKey in the src/cardUtilities.js file.

VS Code version: Code 1.30.2 (61122f8, 2019-01-07T22:54:13.295Z)
OS version: Windows_NT x64 10.0.15063

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz (8 x 1896)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.86GB (8.21GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (6)
Extension Author (truncated) Version
bracket-pair-colorizer-2 Coe 0.0.25
vscode-eslint dba 1.8.0
prettier-vscode esb 1.8.1
vs-keybindings ms- 0.2.0
debugger-for-chrome msj 4.11.1
highlight-matching-tag vin 0.8.6

Activity

  1. jodymbrooks commented on Feb 6, 2019

    @jodymbrooks
    Author

    Additional info: Once I closed the file that was referencing my function of interest, doing FAR from the definition of the function again showed only the 1 reference from the file it was defined in (the opened file).

  2. added
    javascript
    on Feb 22, 2019
  3. mjbvz commented on Apr 8, 2019

    @mjbvz
    Contributor

    Thanks for the project example.

    I think you need a jsconfig.json file. This makes VS Code treat all js files in your workspace as part of the same project (even if they have not been opened yet) Just create a file called jsconfig.json at the root of your project:

    {
        "compilerOptions": {
            "target": "es6"
        },
        "exclude": [
            "node_modules"
        ]
    }
    

    See the jsconfig docs for more info

    Here's what i see for find all references on getCardFromKey after creating the jsconfig:

    Screen Shot 2019-04-08 at 3 40 51 PM

  4. added
    *question
    on Apr 8, 2019
  5. jodymbrooks commented on Apr 8, 2019

    @jodymbrooks
    Author

    Yes that corrected it for me. I'll have to look into that documentation on jsconfig as this means I'm missing some understanding on how VS Code considers the files in your workspace, that open files have meant something different than other files in the WS is interesting. Have to study what that means.

    Thanks for the answer.

  6. locked and limited conversation to collaborators on May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*questionjavascript

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions