fix(tui): scope file autocomplete to session (#33458)

This commit is contained in:
Dax 2026-06-22 20:31:36 -04:00 committed by GitHub
commit ef2357915e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 70 additions and 49 deletions

View file

@ -0,0 +1,14 @@
import type { LocationRef } from "@opencode-ai/sdk/v2"
import { createContext, useContext, type Accessor, type ParentProps } from "solid-js"
const context = createContext<Accessor<LocationRef | undefined>>()
export function LocationProvider(props: ParentProps<{ location?: LocationRef }>) {
return <context.Provider value={() => props.location}>{props.children}</context.Provider>
}
export function useLocation() {
const value = useContext(context)
if (!value) throw new Error("Location context must be used within a LocationProvider")
return value
}