MCPcopy Create free account
hub / github.com/anomalyco/opencode / getFormatter

Function getFormatter

packages/opencode/src/format/index.ts:57–71  ·  view source on GitHub ↗
(ext: string)

Source from the content-addressed store, hash-verified

55 }
56
57 async function getFormatter(ext: string) {
58 const matching = Object.values(formatters).filter((item) => item.extensions.includes(ext))
59 const checks = await Promise.all(
60 matching.map(async (item) => {
61 const cmd = await getCommand(item)
62 return {
63 item,
64 cmd,
65 }
66 }),
67 )
68 return checks
69 .filter((x): x is { item: Formatter.Info; cmd: string[] } => x.cmd !== false)
70 .map((x) => ({ item: x.item, cmd: x.cmd }))
71 }
72
73 function formatFile(filepath: string) {
74 return Effect.gen(function* () {

Callers 1

formatFileFunction · 0.85

Calls 3

getCommandFunction · 0.85
valuesMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected