Add top-level completion for path mapping (#21686) (#21689)

This commit is contained in:
Andy
2018-02-06 11:37:34 -08:00
committed by GitHub
parent c4dca618ce
commit eca6410c6e
2 changed files with 18 additions and 1 deletions

View File

@@ -187,7 +187,7 @@ namespace ts.Completions.PathCompletions {
const pathPrefix = path.slice(0, path.length - 1);
if (!startsWith(fragment, pathPrefix)) {
return emptyArray;
return [pathPrefix];
}
const remainingFragment = fragment.slice(pathPrefix.length);

View File

@@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
// @Filename: /x/src/a.ts
////import {} from "[|/**/|]";
// @Filename: /x/tsconfig.json
////{
//// "compilerOptions": {
//// "baseUrl": ".",
//// "paths": {
//// "foo/*": ["src/*"]
//// }
//// }
////}
const [replacementSpan] = test.ranges();
verify.completionsAt("", ["src", "foo/"].map(name => ({ name, replacementSpan })));