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 work on closed files #52127

Closed
kiyutink opened this issue Jun 17, 2018 · 8 comments
Closed

Find all references doesn't work on closed files #52127

kiyutink opened this issue Jun 17, 2018 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster javascript JavaScript support issues

Comments

@kiyutink
Copy link

  • VSCode Version: 1.24.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Use "Find all references" on a declaration while the file with the reference is closed
  2. Open the file with the reference
  3. Use "Find all references"

Does this issue occur when all extensions are disabled?: Yes

@RMacfarlane RMacfarlane added the editor-symbols definitions, declarations, references label Jun 18, 2018
@jrieken jrieken added info-needed Issue requires more information from poster and removed editor-symbols definitions, declarations, references labels Jun 18, 2018
@jrieken
Copy link
Member

jrieken commented Jun 18, 2018

  • What language/extension are you using?
  • What does closed reference mean?

@kiyutink
Copy link
Author

JavaScript, no extensions.
I didn't mean closed reference, I meant to say that the reference won't be found, if the file with the reference is closed (not opened in the editor)

@jrieken jrieken assigned mjbvz and unassigned jrieken Jun 18, 2018
@jrieken jrieken removed the info-needed Issue requires more information from poster label Jun 18, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 18, 2018

Do you have a jsconfig.json?

@mjbvz mjbvz added info-needed Issue requires more information from poster javascript JavaScript support issues labels Jun 18, 2018
@vscodebot vscodebot bot removed the new release label Jun 20, 2018
@kiyutink
Copy link
Author

hmm, when i add a jsconfig.json it stops finding references even in opened files

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 21, 2018

Please share a minimal code example or small example project

@kiyutink
Copy link
Author

Hey, I've done some checking and found out that it only happens if you search for references of a variable defined in a .jsx file. Unfortunately, I couldn't find how to configure the project to allow VS Code to enable it. To reproduce this you can just create two files as following:

file1.jsx:
export const a = 3;

file2.jsx:
import {a} from './file1.jsx'

Then if you search for references of 'a' from file1.jsx you'll get different results depending on whether you have or don't have a jsconfig.json. If you don't have it you'll only see the reference of 'a' in file2.jsx if it's opened in the editor. If you have a jsconfig.json, you won't see the reference regardless of the file being opened in the editor or not.

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 25, 2018

In your jsconfig.json, make sure you set "jsx": "react" under compilerOptions. That should fix the problem

@mjbvz mjbvz closed this as completed Jun 25, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests

4 participants