init project

This commit is contained in:
Christoph Brandau
2025-01-07 10:22:59 +01:00
commit 09d1685aa9
15 changed files with 470 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
export function formatCdlFile(content: string): string {
let indentLevel = 0;
const formattedLines = [];
for (const line of content.split("\n")) {
const strippedLine = line.trim();
if (strippedLine.endsWith("}")) {
indentLevel = Math.max(indentLevel - 1, 0);
}
formattedLines.push(" ".repeat(indentLevel) + strippedLine);
if (strippedLine.endsWith("{")) {
indentLevel += 1;
}
}
return formattedLines.join("\n");
}