This commit is contained in:
Dax Raad
2026-03-19 17:53:35 -04:00
parent 63af295a17
commit bd7a4cec90
7 changed files with 35 additions and 49 deletions
+15 -6
View File
@@ -37,7 +37,7 @@ export namespace Format {
Effect.gen(function* () {
const instance = yield* InstanceContext
const enabled: Record<string, boolean> = {}
const enabled: Record<string, string[] | false> = {}
const formatters: Record<string, Formatter.Info> = {}
const cfg = yield* Effect.promise(() => Config.get())
@@ -62,7 +62,7 @@ export namespace Format {
formatters[name] = {
...info,
name,
enabled: async () => true,
enabled: async () => info.command,
}
}
} else {
@@ -79,13 +79,22 @@ export namespace Format {
}
async function getFormatter(ext: string) {
const result = []
const result: Array<{
name: string
command: string[]
environment?: Record<string, string>
}> = []
for (const item of Object.values(formatters)) {
log.info("checking", { name: item.name, ext })
if (!item.extensions.includes(ext)) continue
if (!(await isEnabled(item))) continue
const cmd = await isEnabled(item)
if (!cmd) continue
log.info("enabled", { name: item.name, ext })
result.push(item)
result.push({
name: item.name,
command: cmd,
environment: item.environment,
})
}
return result
}
@@ -141,7 +150,7 @@ export namespace Format {
result.push({
name: formatter.name,
extensions: formatter.extensions,
enabled: isOn,
enabled: !!isOn,
})
}
return result
+1
View File
@@ -13,6 +13,7 @@ import { Process } from "../util/process"
import { which } from "../util/which"
import { Module } from "@opencode-ai/util/module"
import { spawn } from "./launch"
import { Npm } from "@/npm"
export namespace LSPServer {
const log = Log.create({ service: "lsp.server" })
+6
View File
@@ -1,4 +1,7 @@
import { streamSSE } from "hono/streaming"
import { Log } from "../util/log"
import { Bus } from "../bus"
import { BusEvent } from "../bus/bus-event"
import { describeRoute, generateSpecs, validator, resolver, openAPIRouteHandler } from "hono-openapi"
import { Hono } from "hono"
import { cors } from "hono/cors"
@@ -585,6 +588,8 @@ export namespace Server {
return result
}
export let url: URL
export async function listen(opts: {
port: number
hostname: string
@@ -626,6 +631,7 @@ export namespace Server {
const url = new URL("http://localhost")
url.hostname = opts.hostname
url.port = String(addr.port)
Server.url = url
const shouldPublishMDNS =
opts.mdns &&
-2
View File
@@ -16,7 +16,6 @@ export namespace Process {
abort?: AbortSignal
kill?: NodeJS.Signals | number
timeout?: number
shell?: string
}
export interface RunOptions extends Omit<Options, "stdout" | "stderr"> {
@@ -65,7 +64,6 @@ export namespace Process {
shell: opts.shell,
env: opts.env === null ? {} : opts.env ? { ...process.env, ...opts.env } : undefined,
stdio: [opts.stdin ?? "ignore", opts.stdout ?? "ignore", opts.stderr ?? "ignore"],
shell: opts.shell,
windowsHide: process.platform === "win32",
})