Skip to content

Salsa - reference search across commonjs fails #6682

Closed
@egamma

Description

@egamma

In the following setup:

version: typescript@1.9.0-dev.20160127

jsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5"
    },
    "exclude": [
        "node_modules"
    ]
}

circle.js

const PI = Math.PI;

exports.area = function (r) {
  return PI * r * r;
};

geometry.js

const circle = require('./circle.js');
console.log( `The area of a circle of radius 4 is ${circle.area(4)}`);

Go to definition from geometry.js area works and navigates to the file circle.js.

Doing a reference search from circle.js exports.area doesn't result in any references.

When changing the code of circle.js to:

const PI = Math.PI;

export function area (r) {
  return PI * r * r;
};

then the reference search returns the correct result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions