mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 22:03:58 +00:00
allow disabling formatter
This commit is contained in:
@@ -5,6 +5,7 @@ import { Log } from "../util/log"
|
||||
import path from "path"
|
||||
|
||||
import * as Formatter from "./formatter"
|
||||
import { Config } from "../config/config"
|
||||
|
||||
export namespace Format {
|
||||
const log = Log.create({ service: "format" })
|
||||
@@ -28,9 +29,11 @@ export namespace Format {
|
||||
}
|
||||
|
||||
async function getFormatter(ext: string) {
|
||||
const cfg = await Config.get()
|
||||
const result = []
|
||||
for (const item of Object.values(Formatter)) {
|
||||
if (!item.extensions.includes(ext)) continue
|
||||
if (cfg.formatter?.[item.name]?.disabled) continue
|
||||
if (!(await isEnabled(item))) continue
|
||||
result.push(item)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user