chore: generate
This commit is contained in:
parent
106f8e94d6
commit
21a644fef5
12 changed files with 40 additions and 50 deletions
|
|
@ -116,7 +116,8 @@ export const { use: useEditorContext, provider: EditorContextProvider } = create
|
|||
const editor = props.integration ?? editorIntegration
|
||||
const value = process.env.CLAUDE_CODE_SSE_PORT || process.env.OPENCODE_EDITOR_SSE_PORT
|
||||
const parsedPort = value ? Number.parseInt(value, 10) : undefined
|
||||
const port = parsedPort && Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535 ? parsedPort : undefined
|
||||
const port =
|
||||
parsedPort && Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535 ? parsedPort : undefined
|
||||
const zedTerminal = process.env.ZED_TERM === "true" || process.env.TERM_PROGRAM?.toLowerCase() === "zed"
|
||||
const mentionListeners = new Set<(mention: EditorMention) => void>()
|
||||
const WebSocketImpl = props.WebSocketImpl ?? WebSocket
|
||||
|
|
@ -319,9 +320,7 @@ export const { use: useEditorContext, provider: EditorContextProvider } = create
|
|||
|
||||
return {
|
||||
enabled() {
|
||||
return Boolean(
|
||||
resolveEditorConnection(directory, port, editor.connection) || (zedTerminal && editor.selection),
|
||||
)
|
||||
return Boolean(resolveEditorConnection(directory, port, editor.connection) || (zedTerminal && editor.selection))
|
||||
},
|
||||
connected() {
|
||||
return store.status === "connected"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const { use: useKV, provider: KVProvider } = createSimpleContext({
|
|||
// Queue same-process writes so rapid updates persist in order.
|
||||
let write = Promise.resolve()
|
||||
|
||||
;Flock.withLock(lock, () => readJson<Record<string, unknown>>(file))
|
||||
Flock.withLock(lock, () => readJson<Record<string, unknown>>(file))
|
||||
.then((x) => {
|
||||
setStore(x)
|
||||
})
|
||||
|
|
@ -55,9 +55,7 @@ export const { use: useKV, provider: KVProvider } = createSimpleContext({
|
|||
setStore(key, value)
|
||||
const snapshot = structuredClone(unwrap(store))
|
||||
write = write
|
||||
.then(() =>
|
||||
Flock.withLock(lock, () => writeJsonAtomic(file, snapshot)),
|
||||
)
|
||||
.then(() => Flock.withLock(lock, () => writeJsonAtomic(file, snapshot)))
|
||||
.catch((error) => {
|
||||
console.error("Failed to write KV state", { error })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -52,7 +52,11 @@ function search<T>(items: T[], target: string, key: (item: T) => string) {
|
|||
return { found: false, index: left }
|
||||
}
|
||||
|
||||
export const { context: SyncContext, use: useSync, provider: SyncProvider } = createSimpleContext({
|
||||
export const {
|
||||
context: SyncContext,
|
||||
use: useSync,
|
||||
provider: SyncProvider,
|
||||
} = createSimpleContext({
|
||||
name: "Sync",
|
||||
init: () => {
|
||||
const startup = useTuiStartup()
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ const themeSource: ThemeSource = {
|
|||
export async function discoverThemes(directories: string[]) {
|
||||
const result: Record<string, unknown> = {}
|
||||
for (const directory of directories) {
|
||||
const files = await Glob.scan("themes/*.json", { cwd: directory, absolute: true, dot: true, symlink: true })
|
||||
for (const file of files) {
|
||||
result[path.basename(file, ".json")] = JSON.parse(await readFile(file, "utf8")) as unknown
|
||||
}
|
||||
const files = await Glob.scan("themes/*.json", { cwd: directory, absolute: true, dot: true, symlink: true })
|
||||
for (const file of files) {
|
||||
result[path.basename(file, ".json")] = JSON.parse(await readFile(file, "utf8")) as unknown
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue