Skip to content

Commit eca6410

Browse files
author
Andy
authored
Add top-level completion for path mapping (#21686) (#21689)
1 parent c4dca61 commit eca6410

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/services/pathCompletions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ namespace ts.Completions.PathCompletions {
187187

188188
const pathPrefix = path.slice(0, path.length - 1);
189189
if (!startsWith(fragment, pathPrefix)) {
190-
return emptyArray;
190+
return [pathPrefix];
191191
}
192192

193193
const remainingFragment = fragment.slice(pathPrefix.length);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: /x/src/a.ts
4+
////import {} from "[|/**/|]";
5+
6+
// @Filename: /x/tsconfig.json
7+
////{
8+
//// "compilerOptions": {
9+
//// "baseUrl": ".",
10+
//// "paths": {
11+
//// "foo/*": ["src/*"]
12+
//// }
13+
//// }
14+
////}
15+
16+
const [replacementSpan] = test.ranges();
17+
verify.completionsAt("", ["src", "foo/"].map(name => ({ name, replacementSpan })));

0 commit comments

Comments
 (0)