Skip to content

Find All Reference from requiring file to module file works only if not default CommonJS exports #22222

Open
@mjbvz

Description

@mjbvz

From @Hoishin on February 28, 2018 4:58

By "default CommonJS exports" I mean module.exports = something, rather than module.exports.foo = something or module.exports = {foo: something}

Might belong to microsoft/vscode#21507, but I thought it is a bit different.

  • VSCode Version: 1.20.1
  • OS Version: macOS High Sierra Version 10.13.3

Steps to Reproduce:

  1. module.exports something
const f = 1234;
module.exports = f;
  1. require it
const f = require('./above-file');
console.log(f);
  1. The f in console.log doesn't show references across files in Find All References. You can find references across files if you Find All References from the module file.

However,

  1. module.exports.foo something
const f = 1234;
module.exports.foo = f;
  1. require it
const {foo} = require('./above-file');
console.log(foo);
  1. The foo in console.log DOES show reference across files in Find All References. You can find references across files if you Find All References from the module file.

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

Copied from original issue: microsoft/vscode#44700

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions