Path: blob/master/src/packages/project/conat/formatter.ts
1447 views
/*1File formatting service.2*/34import { run_formatter, type Options } from "../formatters";5import { createFormatterService as create } from "@cocalc/conat/service/formatter";6import { compute_server_id, project_id } from "@cocalc/project/data";78interface Message {9path: string;10options: Options;11}1213export async function createFormatterService({ openSyncDocs }) {14const impl = {15formatter: async (opts: Message) => {16const syncstring = openSyncDocs[opts.path];17if (syncstring == null) {18throw Error(`"${opts.path}" is not opened`);19}20return await run_formatter({ ...opts, syncstring });21},22};23return await create({ compute_server_id, project_id, impl });24}252627