Skip to content

Commit 577cc1b

Browse files
authored
fix(52233): Ambient modules declared with patterns are offered in path completions (#52246)
1 parent 243d8de commit 577cc1b

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/services/stringCompletions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ function removeLeadingDirectorySeparator(path: string): string {
10251025
function getAmbientModuleCompletions(fragment: string, fragmentDirectory: string | undefined, checker: TypeChecker): readonly string[] {
10261026
// Get modules that the type checker picked up
10271027
const ambientModules = checker.getAmbientModules().map(sym => stripQuotes(sym.name));
1028-
const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment));
1028+
const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment) && moduleName.indexOf("*") < 0);
10291029

10301030
// Nested modules of the form "module-name/sub" need to be adjusted to only return the string
10311031
// after the last '/' that appears in the fragment because that's where the replacement span
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"marker": {
4+
"fileName": "/a.ts",
5+
"position": 22,
6+
"name": ""
7+
},
8+
"completionList": {
9+
"isGlobalCompletion": false,
10+
"isMemberCompletion": false,
11+
"isNewIdentifierLocation": true,
12+
"entries": []
13+
}
14+
}
15+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @filename: /globals.d.ts
4+
////declare module "*.css";
5+
6+
// @filename: /a.ts
7+
////import * as foo from "/**/";
8+
9+
verify.baselineCompletions();

0 commit comments

Comments
 (0)