You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix indentation for arrays in else if and object literals
- Prevent double indentation for arrays/objects when they appear on the
same line as another active indentor (e.g. `else if ArrayContains([`).
- Ensure object literals assigned to array keys (e.g. `m["key"] = {`)
are still indented correctly by tracking active indentors on the line.
// Track the number of open indentors created on this line.
75
+
// This is used to determine if we should suppress indentation for structure indentors (like `[` or `{`).
76
+
// We only suppress if there is an *active* indentor on this line (e.g. `if ArrayContains([`).
77
+
// If an indentor was closed (e.g. `m["key"] = {`), we should NOT suppress.
78
+
letactiveIndentorsOnThisLine=0;
63
79
64
80
for(leti=0;i<lineTokens.length;i++){
65
81
lettoken=lineTokens[i];
@@ -73,6 +89,10 @@ export class IndentFormatter {
73
89
74
90
//if the previous token was `else` and this token is `if`, skip this token. (we used to have a single token for `elseif` but it got split out in an update of brighterscript)
0 commit comments