FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(tui): allow file_context to be disabled by max-wittig · Pull Request #28443 · anomalyco/opencode · GitHub

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (2) .tsx  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
      • app.tsx
        • index.tsx
7 changes: 6 additions & 1 deletion packages/opencode/src/cli/cmd/tui/app.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,13 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
},
{
name: "app.toggle.file_context",
title: kv.get("file_context_enabled", true) ? "Disable file context" : "Enable file context",
title: tuiConfig.file_context === false
? "File context disabled in tui.json"
: kv.get("file_context_enabled", true)
? "Disable file context"
: "Enable file context",
category: "System",
enabled: tuiConfig.file_context !== false,
run: () => {
kv.set("file_context_enabled", !kv.get("file_context_enabled", true))
dialog.clear()
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function Prompt(props: PromptProps) {
const animationsEnabled = createMemo(() => kv.get("animations_enabled", true))
const list = createMemo(() => props.placeholders?.normal ?? [])
const shell = createMemo(() => props.placeholders?.shell ?? [])
const fileContextEnabled = createMemo(() => kv.get("file_context_enabled", true))
const fileContextEnabled = createMemo(() => tuiConfig.file_context !== false && kv.get("file_context_enabled", true))
const [dismissedEditorSelectionKey, setDismissedEditorSelectionKey] = createSignal<string>()
const editorContext = createMemo(() => {
const selection = fileContextEnabled() ? editor.selection() : undefined
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export const TuiInfo = Schema.Struct({
description: "TUI scroll speed",
}),
scroll_acceleration: Schema.optional(ScrollAcceleration),
file_context: Schema.optional(Schema.Boolean).annotate({
description: "Show and submit editor open-file context in the prompt footer (default: true)",
}),
diff_style: Schema.optional(DiffStyle),
mouse: Schema.optional(Schema.Boolean).annotate({ description: "Enable or disable mouse capture (default: true)" }),
})
15 changes: 15 additions & 0 deletions packages/opencode/test/config/tui.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ it.instance("resolves attention config defaults and overrides", () =>
),
)

it.instance("loads file context display option", () =>
withCleanState(
Effect.gen(function* () {
const fs = yield* AppFileSystem.Service
const test = yield* TestInstance

expect((yield* getTuiConfig(test.directory)).file_context).toBeUndefined()

yield* fs.writeJson(path.join(test.directory, "tui.json"), { file_context: false })

expect((yield* getTuiConfig(test.directory)).file_context).toBe(false)
}),
),
)

it.instance("migrates tui-specific keys from opencode.json when tui.json does not exist", () =>
withCleanState(
Effect.gen(function* () {
Expand Down
Loading

Back | FazBrowse Home | New Git URL