init project
This commit is contained in:
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user