refactor: pass formatter instance context explicitly (#23020)
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user