TypeScript/tests/cases/fourslash/completionsImport_ofAlias.ts
Andy 9615e54e13 Support multiple completions with the same name but different source module (#19455)
* Support multiple completions with the same name but different source module

* Use optional parameters for source

* Simplify use of `uniques`

* Update test

* Fix `undefined` error
2017-10-26 08:22:17 -07:00

31 lines
836 B
TypeScript

/// <reference path="fourslash.ts" />
// Tests that we don't filter out a completion for an alias,
// so long as it's not an alias to a different module.
// @Filename: /a.ts
////const foo = 0;
////export { foo };
// @Filename: /a_reexport.ts
// Should not show up in completions
////export { foo } from "./a";
// @Filename: /b.ts
////fo/**/
goTo.marker("");
// https://github.com/Microsoft/TypeScript/issues/14003
verify.completionListContains({ name: "foo", source: "/a" }, "import foo", "", "alias", /*spanIndex*/ undefined, /*hasAction*/ true);
verify.not.completionListContains({ name: "foo", source: "/a_reexport" });
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/a",
description: `Import 'foo' from "./a".`,
// TODO: GH#18445
newFileContent: `import { foo } from "./a";\r
\r
fo`,
});