Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jodymbrooks opened this issue Feb 6, 2019 · 3 comments
Assignees
Labels
javascript JavaScript support issues *question Issue represents a question, should be posted to StackOverflow (VS Code)
Milestone

Comments

@jodymbrooks
Copy link

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
@jodymbrooks
Copy link
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).

@mjbvz mjbvz added this to the March 2019 milestone Feb 22, 2019
@mjbvz mjbvz added the javascript JavaScript support issues label Feb 22, 2019
@mjbvz mjbvz modified the milestones: March 2019, April 2019 Mar 25, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 8, 2019

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

@mjbvz mjbvz closed this as completed Apr 8, 2019
@mjbvz mjbvz added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Apr 8, 2019
@jodymbrooks
Copy link
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.

@vscodebot vscodebot bot locked and limited conversation to collaborators May 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues *question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants