MCPcopy Create free account
hub / github.com/anomalyco/opencode / useSearchHandle

Function useSearchHandle

packages/session-ui/src/components/file.tsx:407–422  ·  view source on GitHub ↗
(opts: {
  search: () => FileSearchControl | undefined
  find: ReturnType<typeof createFileFind>
})

Source from the content-addressed store, hash-verified

405}
406
407function useSearchHandle(opts: {
408 search: () => FileSearchControl | undefined
409 find: ReturnType<typeof createFileFind>
410}) {
411 createEffect(() => {
412 const search = opts.search()
413 if (!search) return
414
415 const handle = {
416 focus: () => opts.find.focus(),
417 } satisfies FileSearchHandle
418
419 search.register(handle)
420 onCleanup(() => search.register(null))
421 })
422}
423
424function createLineCallbacks(opts: {
425 viewer: Viewer

Callers 2

TextViewerFunction · 0.85
DiffViewerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected