MCPcopy Index your code
hub / github.com/anomalyco/opencode / createOpenReviewFile

Function createOpenReviewFile

packages/app/src/pages/session/helpers.ts:108–128  ·  view source on GitHub ↗
(input: {
  showAllFiles: () => void
  tabForPath: (path: string) => string
  openTab: (tab: string) => void
  setActive: (tab: string) => void
  loadFile: (path: string) => any | Promise<void>
})

Source from the content-addressed store, hash-verified

106}
107
108export 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
130export const createOpenSessionFileTab = (input: {
131 normalizeTab: (tab: string) => string

Callers 2

PageFunction · 0.90
helpers.test.tsFile · 0.90

Calls 2

batchFunction · 0.85
openFunction · 0.70

Tested by

no test coverage detected