diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 6ff21d4159b..42939f7fe13 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1025,7 +1025,7 @@ function removeLeadingDirectorySeparator(path: string): string { function getAmbientModuleCompletions(fragment: string, fragmentDirectory: string | undefined, checker: TypeChecker): readonly string[] { // Get modules that the type checker picked up const ambientModules = checker.getAmbientModules().map(sym => stripQuotes(sym.name)); - const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment)); + const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment) && moduleName.indexOf("*") < 0); // Nested modules of the form "module-name/sub" need to be adjusted to only return the string // after the last '/' that appears in the fragment because that's where the replacement span diff --git a/tests/baselines/reference/completionForStringLiteralImport3.baseline b/tests/baselines/reference/completionForStringLiteralImport3.baseline new file mode 100644 index 00000000000..eb38cecad9e --- /dev/null +++ b/tests/baselines/reference/completionForStringLiteralImport3.baseline @@ -0,0 +1,15 @@ +[ + { + "marker": { + "fileName": "/a.ts", + "position": 22, + "name": "" + }, + "completionList": { + "isGlobalCompletion": false, + "isMemberCompletion": false, + "isNewIdentifierLocation": true, + "entries": [] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/completionForStringLiteralImport3.ts b/tests/cases/fourslash/completionForStringLiteralImport3.ts new file mode 100644 index 00000000000..8f3462915d3 --- /dev/null +++ b/tests/cases/fourslash/completionForStringLiteralImport3.ts @@ -0,0 +1,9 @@ +/// + +// @filename: /globals.d.ts +////declare module "*.css"; + +// @filename: /a.ts +////import * as foo from "/**/"; + +verify.baselineCompletions();