summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/code.tsx
diff options
context:
space:
mode:
authorDavid Hill <[email protected]>2025-11-10 13:44:12 +0000
committerDavid Hill <[email protected]>2025-11-10 13:44:12 +0000
commitc6e830c954418808dc39284a1c073aa63a6d4d21 (patch)
tree9c3052e0509115188768a553c0be5a8441ebdd96 /packages/ui/src/components/code.tsx
parent7088bfabd773e2f076aab1c9d2468c04feff0570 (diff)
parentfc78c28df64383a9f99382093f61fc28caf6569f (diff)
downloadopencode-c6e830c954418808dc39284a1c073aa63a6d4d21.tar.gz
opencode-c6e830c954418808dc39284a1c073aa63a6d4d21.zip
Merge branch 'dev' of https://github.com/sst/opencode into dev
Diffstat (limited to 'packages/ui/src/components/code.tsx')
-rw-r--r--packages/ui/src/components/code.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/ui/src/components/code.tsx b/packages/ui/src/components/code.tsx
index f1c7efada..06541fe4e 100644
--- a/packages/ui/src/components/code.tsx
+++ b/packages/ui/src/components/code.tsx
@@ -11,20 +11,21 @@ export type CodeProps<T = {}> = FileOptions<T> & {
export function Code<T>(props: CodeProps<T>) {
let container!: HTMLDivElement
const [local, others] = splitProps(props, ["file", "class", "classList", "annotations"])
- const file = () => local.file
createEffect(() => {
const instance = new File<T>({
- theme: { dark: "oc-1-dark", light: "oc-1-light" }, // or any Shiki theme
+ theme: "OpenCode",
overflow: "wrap", // or 'scroll'
themeType: "system", // 'system', 'light', or 'dark'
+ disableFileHeader: true,
disableLineNumbers: false, // optional
// lang: 'typescript', // optional - auto-detected from filename if not provided
...others,
})
+ container.innerHTML = ""
instance.render({
- file: file(),
+ file: local.file,
lineAnnotations: local.annotations,
containerWrapper: container,
})