TypeScript/tests/cases/fourslash/completionsInExport_moduleBlock.ts
Andrew Branch 0f3a9d4d4b
Support completions for local named exports (#37606)
* Support completions for local named exports

* Add JSDoc

* Use sort text instead of filtering

* Revert new CompletionKind

* Return valid completions even when export declaration is in an invalid place
2020-03-27 10:47:02 -07:00

43 lines
960 B
TypeScript

/// <reference path="fourslash.ts" />
////const outOfScope = 0;
////
////declare module 'mod' {
//// const a: string;
//// type T = number;
//// export { /**/ };
////}
verify.completions({
marker: "",
exact: ["a", "T"]
});
// Deprioritize 'a' since it has been exported already.
// (Keep it in the list because you can still do 'a as b'.)
edit.insert("a, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
});
// No completions for new name
edit.insert("T as ");
verify.completions({
exact: []
});
// 'T' still hasn't been exported by name
edit.insert("U, ");
verify.completions({
exact: [{ name: "a", sortText: completion.SortText.OptionalMember }, "T"]
});
// 'a' and 'T' are back to the same priority
edit.insert("T, ");
verify.completions({
exact: [
{ name: "a", sortText: completion.SortText.OptionalMember },
{ name: "T", sortText: completion.SortText.OptionalMember }
]
});