diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 49dde4ea6e..0fbe3358ce 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -24470,6 +24470,7 @@ namespace ts { return undefined; case SyntaxKind.StringLiteral: + case SyntaxKind.NoSubstitutionTemplateLiteral: // 1). import x = require("./mo/*gotToDefinitionHere*/d") // 2). External module name in an import declaration // 3). Dynamic import call or require in javascript diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 68ada59125..6e43ac37de 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -275,7 +275,7 @@ namespace ts.FindAllReferences.Core { } function isModuleReferenceLocation(node: ts.Node): boolean { - if (node.kind !== SyntaxKind.StringLiteral) { + if (node.kind !== SyntaxKind.StringLiteral && node.kind !== SyntaxKind.NoSubstitutionTemplateLiteral) { return false; } switch (node.parent.kind) { diff --git a/tests/cases/fourslash/completionsPaths.ts b/tests/cases/fourslash/completionsPaths.ts index 9473ae54b2..454ef78eef 100644 --- a/tests/cases/fourslash/completionsPaths.ts +++ b/tests/cases/fourslash/completionsPaths.ts @@ -17,5 +17,14 @@ // @Filename: /src/folder/b.ts ////import {} from "x//*2*/"; +// @Filename: /src/folder/c.ts +////const foo = require("x//*3*/"); + +// @Filename: /src/folder/4.ts +////const foo = require(`x//*4*/`); + verify.completionsAt("1", ["y", "x"]); verify.completionsAt("2", ["bar", "foo"]); +verify.completionsAt("3", ["bar", "foo"]); +verify.completionsAt("4", ["bar", "foo"]); + diff --git a/tests/cases/fourslash/quickInfoForRequire.ts b/tests/cases/fourslash/quickInfoForRequire.ts index fe92394542..231dd8603b 100644 --- a/tests/cases/fourslash/quickInfoForRequire.ts +++ b/tests/cases/fourslash/quickInfoForRequire.ts @@ -5,6 +5,11 @@ //@Filename: quickInfoForRequire_input.ts ////import a = require("./AA/B/*1*/B"); +////import b = require(`./AA/B/*2*/B`); + goTo.marker("1"); verify.quickInfoIs("module a"); + +goTo.marker("2"); +verify.quickInfoIs("module a");