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

Function reconnectWithDirectory

packages/tui/src/context/editor.ts:290–309  ·  view source on GitHub ↗
(nextDirectory?: string)

Source from the content-addressed store, hash-verified

288 }
289
290 const reconnectWithDirectory = (nextDirectory?: string) => {
291 const resolved = nextDirectory || paths.cwd
292 const sameDirectory = directory === resolved
293 clearSelectionForReconnect({ resetZedSelectionKey: !sameDirectory })
294 if (sameDirectory) return
295
296 directory = resolved
297 attempt = 0
298 pending.clear()
299 if (reconnect) clearTimeout(reconnect)
300 reconnect = undefined
301 if (socket) {
302 const current = socket
303 socket = undefined
304 current.close()
305 }
306 setStore("status", "disabled")
307 setStore("server", undefined)
308 connect()
309 }
310
311 onMount(() => {
312 connect()

Callers 1

reconnectFunction · 0.85

Calls 5

setStoreFunction · 0.85
connectFunction · 0.70
clearMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected