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

Function resolvePrettierConfig

src/lib/prettierFormatter.js:122–139  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

120}
121
122async function resolvePrettierConfig(file) {
123 const overrides = appSettings?.value?.prettier || {};
124 const projectConfig = await loadProjectConfig(file);
125 const result = { ...overrides, ...(projectConfig || {}) };
126 if (file?.eol && result.endOfLine == null) {
127 result.endOfLine = file.eol === "windows" ? "crlf" : "lf";
128 }
129 if (result.useTabs == null) {
130 result.useTabs = !appSettings?.value?.softTab;
131 }
132 if (
133 result.tabWidth == null &&
134 typeof appSettings?.value?.tabSize === "number"
135 ) {
136 result.tabWidth = appSettings.value.tabSize;
137 }
138 return result;
139}
140
141async function loadProjectConfig(file) {
142 const uri = file?.uri;

Callers 1

Calls 1

loadProjectConfigFunction · 0.85

Tested by

no test coverage detected