(input: {
showAllFiles: () => void
tabForPath: (path: string) => string
openTab: (tab: string) => void
setActive: (tab: string) => void
loadFile: (path: string) => any | Promise<void>
})
| 106 | } |
| 107 | |
| 108 | export const createOpenReviewFile = (input: { |
| 109 | showAllFiles: () => void |
| 110 | tabForPath: (path: string) => string |
| 111 | openTab: (tab: string) => void |
| 112 | setActive: (tab: string) => void |
| 113 | loadFile: (path: string) => any | Promise<void> |
| 114 | }) => { |
| 115 | return (path: string) => { |
| 116 | batch(() => { |
| 117 | input.showAllFiles() |
| 118 | const maybePromise = input.loadFile(path) |
| 119 | const open = () => { |
| 120 | const tab = input.tabForPath(path) |
| 121 | input.openTab(tab) |
| 122 | input.setActive(tab) |
| 123 | } |
| 124 | if (maybePromise instanceof Promise) void maybePromise.then(open) |
| 125 | else open() |
| 126 | }) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | export const createOpenSessionFileTab = (input: { |
| 131 | normalizeTab: (tab: string) => string |
no test coverage detected