TypeScript/tests/cases/fourslash/completionsImport_reExport_wrongName.ts
Andrew Branch 03c79d7422
Insert auto-imports in sorted order (#39394)
* Sort auto-imports

* Avoid re-checking sort all the time

* Add comment
2020-07-08 15:25:04 -07:00

54 lines
1.2 KiB
TypeScript

/// <reference path="fourslash.ts" />
// @moduleResolution: node
// @Filename: /a.ts
////export const x = 0;
// @Filename: /index.ts
////export { x as y } from "./a";
// @Filename: /c.ts
/////**/
goTo.marker("");
verify.completions({
marker: "",
includes: [
{
name: "x",
source: "/a",
sourceDisplay: "./a",
text: "const x: 0",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "y",
source: "/index",
sourceDisplay: ".",
text: "(alias) const y: 0\nexport y",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
],
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "x",
source: "/a",
description: `Import 'x' from module "./a"`,
newFileContent: `import { x } from "./a";
`,
});
verify.applyCodeActionFromCompletion("", {
name: "y",
source: "/index",
description: `Import 'y' from module "."`,
newFileContent: `import { y } from ".";
import { x } from "./a";
`,
});