-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider module symbol in completion details exportInfo lookup
- Loading branch information
1 parent
a0afacd
commit a1d36cd
Showing
2 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
tests/cases/fourslash/server/autoImportReExportFromAmbientModule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/// <reference path="../fourslash.ts" /> | ||
|
||
// @Filename: /tsconfig.json | ||
//// { | ||
//// "compilerOptions": { | ||
//// "module": "commonjs" | ||
//// } | ||
//// } | ||
|
||
// @Filename: /node_modules/@types/node/index.d.ts | ||
//// declare module "fs" { | ||
//// export function accessSync(path: string): void; | ||
//// } | ||
|
||
// @Filename: /node_modules/@types/fs-extra/index.d.ts | ||
//// export * from "fs"; | ||
|
||
// @Filename: /index.ts | ||
//// access/**/ | ||
|
||
verify.completions({ | ||
marker: "", | ||
includes: [{ | ||
name: "accessSync", | ||
source: "fs", | ||
sourceDisplay: "fs", | ||
hasAction: true, | ||
sortText: completion.SortText.AutoImportSuggestions | ||
}, { | ||
name: "accessSync", | ||
source: "fs-extra", | ||
sourceDisplay: "fs-extra", | ||
hasAction: true, | ||
sortText: completion.SortText.AutoImportSuggestions | ||
}], | ||
preferences: { | ||
includeCompletionsForModuleExports: true, | ||
allowIncompleteCompletions: true | ||
} | ||
}); | ||
|
||
verify.applyCodeActionFromCompletion("", { | ||
name: "accessSync", | ||
source: "fs-extra", | ||
description: `Add import from "fs-extra"`, | ||
newFileContent: `import { accessSync } from "fs-extra";\r\n\r\naccess`, | ||
data: { | ||
exportName: "accessSync", | ||
fileName: "/node_modules/@types/fs-extra/index.d.ts", | ||
moduleSpecifier: "fs-extra", | ||
} | ||
}); |