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

@ -80,7 +80,8 @@ import { usePluginRuntime } from "../../plugin/runtime"
import { DialogRetryAction } from "../../component/dialog-retry-action"
import { getRevertDiffFiles } from "../../util/revert-diff"
import { OPENCODE_BASE_MODE, useBindings, useCommandShortcut, useOpencodeKeymap } from "../../keymap"
import { PathFormatterProvider, usePathFormatter } from "../../context/path-format"
import { usePathFormatter } from "../../context/path-format"
import { LocationProvider } from "../../context/location"
addDefaultParsers(parsers.parsers)
@ -193,6 +194,10 @@ export function Session() {
const { theme } = useTheme()
const promptRef = usePromptRef()
const session = createMemo(() => sync.session.get(route.sessionID))
const location = createMemo(() => {
const current = session()
return current ? { directory: current.directory, workspaceID: current.workspaceID } : undefined
})
createEffect(() => {
const title = Locale.truncate(session()?.title ?? "", 50)
@ -1138,7 +1143,7 @@ export function Session() {
createEffect(on(() => route.sessionID, toBottom))
return (
<PathFormatterProvider path={session()?.directory}>
<LocationProvider location={location()}>
<context.Provider
value={{
get width() {
@ -1338,7 +1343,7 @@ export function Session() {
</Show>
</box>
</context.Provider>
</PathFormatterProvider>
</LocationProvider>
)
}