File tree Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -22645,14 +22645,16 @@ namespace ts {
22645
22645
return undefined;
22646
22646
22647
22647
case SyntaxKind.StringLiteral:
22648
+ // import x = require("./mo/*gotToDefinitionHere*/d")
22649
+ if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) {
22650
+ return resolveExternalModuleName(node, <LiteralExpression>node);
22651
+ }
22648
22652
// External module name in an import declaration
22649
- if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) &&
22650
- getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
22651
- ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) &&
22652
- (<ImportDeclaration>node.parent).moduleSpecifier === node)) {
22653
+ if ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (<ImportDeclaration>node.parent).moduleSpecifier === node) {
22653
22654
return resolveExternalModuleName(node, <LiteralExpression>node);
22654
22655
}
22655
- if (isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
22656
+ if ((isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) ||
22657
+ isImportCall(node.parent)) {
22656
22658
return resolveExternalModuleName(node, <LiteralExpression>node);
22657
22659
}
22658
22660
// falls through
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ namespace ts.FindAllReferences.Core {
307
307
case SyntaxKind . ExportDeclaration :
308
308
return true ;
309
309
case SyntaxKind . CallExpression :
310
- return isRequireCall ( node . parent as CallExpression , /*checkArgumentIsStringLiteral*/ false ) ;
310
+ return isRequireCall ( node . parent as CallExpression , /*checkArgumentIsStringLiteral*/ false ) || isImportCall ( node . parent as CallExpression ) ;
311
311
default :
312
312
return false ;
313
313
}
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts' />
2
+
3
+ // @Filename : foo.ts
4
+ //// export function foo() { return "foo"; }
5
+
6
+ //// import("[|./foo|]")
7
+ //// var x = import("[|./foo|]")
8
+
9
+ verify . rangesReferenceEachOther ( ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts' />
2
+
3
+ // @Filename : foo.ts
4
+ //// /*Destination*/export function foo() { return "foo"; }
5
+
6
+ //// import("./f/*1*/oo")
7
+ //// var x = import("./fo/*2*/o")
8
+
9
+ verify . goToDefinition ( "1" , "Destination" ) ;
10
+ verify . goToDefinition ( "2" , "Destination" ) ;
You can’t perform that action at this time.
0 commit comments