• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// <reference path="fourslash.ts" />
2
3// @noLib: true
4
5// @Filename: /a.ts
6////export class Cls {}
7////export function f(c: Cls) {}
8
9// @Filename: /b.ts
10////import { f } from "./a";
11// Here we will recommend a new import of 'Cls'
12////f(new C/*b0*/);
13////f(new /*b1*/);
14
15// @Filename: /c.ts
16////import * as alpha from "./a";
17// Here we will recommend 'alpha' because it contains 'Cls'.
18////alpha.f(new al/*c0*/);
19////alpha.f(new /*c1*/);
20
21const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForModuleExports: true };
22const classEntry = (isConstructor: boolean): FourSlashInterface.ExpectedCompletionEntry => ({
23    name: "Cls",
24    source: "/a",
25    sourceDisplay: "./a",
26    kind: "class",
27    kindModifiers: "export",
28    text: isConstructor ? "constructor Cls(): Cls" : "class Cls",
29    hasAction: true,
30    isRecommended: true,
31    sortText: completion.SortText.AutoImportSuggestions
32});
33verify.completions(
34    { marker: "b0", includes: classEntry(true), preferences },
35    { marker: "b1", includes: classEntry(false), preferences },
36    {
37        marker: ["c0", "c1"],
38        includes: {
39            name: "alpha",
40            text: "import alpha",
41            kind: "alias",
42            isRecommended: true,
43        },
44        preferences,
45    },
46);
47