diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 6eb4414df25..a4412ca8826 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -404,8 +404,8 @@ namespace FourSlashInterface { this.state.baselineSignatureHelp(); } - public baselineCompletions() { - this.state.baselineCompletions(); + public baselineCompletions(preferences?: ts.UserPreferences) { + this.state.baselineCompletions(preferences); } public baselineSmartSelection() { diff --git a/tests/cases/fourslash/autoImportPathsAliasesAndBarrels.ts b/tests/cases/fourslash/autoImportPathsAliasesAndBarrels.ts new file mode 100644 index 00000000000..3225645cbfb --- /dev/null +++ b/tests/cases/fourslash/autoImportPathsAliasesAndBarrels.ts @@ -0,0 +1,59 @@ +/// + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "commonjs", +//// "paths": { +//// "~/*": ["src/*"] +//// } +//// } +////} + +// @Filename: /src/dirA/index.ts +//// export * from "./thing1A"; +//// export * from "./thing2A"; + +// @Filename: /src/dirA/thing1A.ts +//// export class Thing1A {} +//// Thing/**/ + +// @Filename: /src/dirA/thing2A.ts +//// export class Thing2A {} + +// @Filename: /src/dirB/index.ts +//// export * from "./thing1B"; +//// export * from "./thing2B"; + +// @Filename: /src/dirB/thing1B.ts +//// export class Thing1B {} + +// @Filename: /src/dirB/thing2B.ts +//// export class Thing2B {} + +verify.completions({ + marker: "", + includes: [{ + name: "Thing2A", + source: "./thing2A", + sourceDisplay: "./thing2A", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions, + }, { + name: "Thing1B", + source: "~/dirB", + sourceDisplay: "~/dirB", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions, + }, { + name: "Thing2B", + source: "~/dirB", + sourceDisplay: "~/dirB", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions, + }], + preferences: { + includeCompletionsForModuleExports: true, + allowIncompleteCompletions: true, + }, +}); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 93aca2cfb1f..79e0f52cb58 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -349,7 +349,7 @@ declare namespace FourSlashInterface { baselineSyntacticDiagnostics(): void; baselineSyntacticAndSemanticDiagnostics(): void; getEmitOutput(expectedOutputFiles: ReadonlyArray): void; - baselineCompletions(): void; + baselineCompletions(preferences?: UserPreferences): void; baselineQuickInfo(): void; baselineSmartSelection(): void; baselineSignatureHelp(): void;