Skip to content

"Find all references" does not work with javascript require when files closed #58972

Closed

Description

  • VSCode Version: 1.28.0-insider
  • OS Version: Mac OSX 10.13.6 (17G65)

Steps to Reproduce:

  1. Clone this demo repo: https://github.com/AJamesPhillips/demo-find-all-references (or set up the repository structure shown below)
  2. With only file1.js open and the cursor on createRouter, pressing shift + F12. The "Find all references" only shows references in the current file.

If index.js is also open then "Find all references" correctly shows references to the file1.js export in index.js.

Repository structure:

/file1.js

module.exports = createRouter
function createRouter () {}

/index.js

const file1Router = require('./file1')
file1Router()

Is this a known bug? I searched the issues but couldn't find anything: https://github.com/Microsoft/vscode/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+%22Find+all+references%22

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

Activity

  1. added
    javascript
    and removed on Sep 20, 2018
  2. mjbvz commented on Sep 20, 2018

    @mjbvz
    Contributor

    Try creating a jsconfig.json at the root of your project with the contents:

    {
        "compilerOptions": {
            "target": "ES6"
        },
        "exclude": [
            "node_modules",
            "**/node_modules/*"
        ]
    }

    This tells vs code to treat all js files in the workspace as part of the same project, even if they are not open

  3. locked and limited conversation to collaborators on Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

javascript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions