refactor: pass formatter instance context explicitly (#23020)

This commit is contained in:
Kit Langton
2026-04-17 21:22:36 -04:00
committed by GitHub
parent a92c75e5f4
commit a5d99e7a3c
2 changed files with 24 additions and 22 deletions
+3 -3
View File
@@ -37,14 +37,14 @@ export const layer = Layer.effect(
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner
const state = yield* InstanceState.make(
Effect.fn("Format.state")(function* (_ctx) {
Effect.fn("Format.state")(function* (ctx) {
const commands: Record<string, string[] | false> = {}
const formatters: Record<string, Formatter.Info> = {}
async function getCommand(item: Formatter.Info) {
let cmd = commands[item.name]
if (cmd === false || cmd === undefined) {
cmd = await item.enabled()
cmd = await item.enabled(ctx)
commands[item.name] = cmd
}
return cmd
@@ -153,7 +153,7 @@ export const layer = Layer.effect(
...info,
name,
extensions: info.extensions ?? [],
enabled: builtIn && !info.command ? builtIn.enabled : async () => info.command ?? false,
enabled: builtIn && !info.command ? builtIn.enabled : async (_context) => info.command ?? false,
}
}
}