Handle the require call in javascript file for getSymbolAtLocation

This helps in getting the alias symbol so that it can go to the definition of external module
Fixes #9251
This commit is contained in:
Sheetal Nandi 2016-10-05 17:19:38 -07:00
parent f30874763f
commit d8280d8807
2 changed files with 15 additions and 0 deletions

View File

@ -18167,6 +18167,9 @@ namespace ts {
(<ImportDeclaration>node.parent).moduleSpecifier === node)) {
return resolveExternalModuleName(node, <LiteralExpression>node);
}
if (isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
return resolveExternalModuleName(node, <LiteralExpression>node);
}
// Fall through
case SyntaxKind.NumericLiteral:

View File

@ -0,0 +1,12 @@
/// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: foo.js
/////*2*/module.exports = {};
// @Filename: bar.js
////var x = require(/*1*/"./foo");
goTo.marker("1");
goTo.definition();
verify.caretAtMarker("2");