Fix quick info for require template string (#20851)
* Fix quick info for require template string Fixes #20850 * Add path completions tests
This commit is contained in:
parent
2ea5f58d60
commit
3f577b8617
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"]);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue