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

Function resolveEditorConnection

packages/tui/src/context/editor.ts:361–374  ·  view source on GitHub ↗
(
  directory: string,
  port: number | undefined,
  discover: ((directory: string) => EditorConnection | undefined) | undefined,
)

Source from the content-addressed store, hash-verified

359})
360
361function resolveEditorConnection(
362 directory: string,
363 port: number | undefined,
364 discover: ((directory: string) => EditorConnection | undefined) | undefined,
365): EditorConnection | undefined {
366 if (port) {
367 return {
368 url: `ws://127.0.0.1:${port}`,
369 source: `env:${port}`,
370 }
371 }
372
373 return discover?.(directory)
374}
375
376export function editorSelectionKey(selection: EditorSelection | undefined) {
377 if (!selection) return ""

Callers 2

connectFunction · 0.85
enabledFunction · 0.85

Calls 1

discoverFunction · 0.70

Tested by

no test coverage detected