no indentation for comments....

This commit is contained in:
chromoxdor
2025-07-21 17:25:53 +02:00
parent dc8e6dcbce
commit 120ea954d3
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -283,8 +283,11 @@ function initalAutocorrection() {
function formatLogic(text) {
const INDENT = ' '; // 2 spaces
const lines = text.split('\n').map(line => line.trim()); // remove all existing indentation
const lines = text.split('\n').map(line => {
const trimmed = line.trimStart(); // remove leading spaces only
return trimmed.startsWith('//') ? line : trimmed;
});
let indentLevel = 0;
const result = [];
const stack = [];
@@ -383,8 +386,14 @@ function formatLogic(text) {
continue;
}
// any normal line inside On block
result.push(INDENT.repeat(indentLevel) + line);
if (line.trim().startsWith('//')) {
// no indentation for comments
result.push(line);
} else {
// any normal line inside On block
result.push(INDENT.repeat(indentLevel) + line);
}
continue;
}
+1 -1
View File
File diff suppressed because one or more lines are too long