MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / registerPrettierFormatter

Function registerPrettierFormatter

src/lib/registerPrettierFormatter.js:28–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26];
27
28export function registerPrettierFormatter() {
29 if (!window?.acode) return;
30 const alreadyRegistered = acode.formatters.some(
31 ({ id }) => id === PRETTIER_ID,
32 );
33 if (alreadyRegistered) return;
34
35 acode.registerFormatter(
36 PRETTIER_ID,
37 SUPPORTED_EXTENSIONS,
38 async () => {
39 const { formatActiveFileWithPrettier } = await import(
40 /* webpackChunkName: "prettierFormatter" */ "lib/prettierFormatter"
41 );
42 return formatActiveFileWithPrettier();
43 },
44 PRETTIER_NAME,
45 );
46}

Callers 1

onDeviceReadyFunction · 0.90

Calls 2

registerFormatterMethod · 0.80

Tested by

no test coverage detected