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
funmain() {
funinnerFun0() {
// some code
} // ktlint-disablefuninnerFunc1() {
// some code
}
}
Your Environment
Version of ktlint used: 0.47
No .editorconfig
Version of Gradle used (if applicable): No
Operating System and version: MacOS 12.5
Possible reasons
ktlint's indentation rule records the braces with a stack, and when I use // ktlint-disable on the line where the braces are, the indentation rule does not check this ASTNode and the stack does not change, hence the problem.
The text was updated successfully, but these errors were encountered:
I think the solution to this is simply to make ktlint always perform a visit for each node. But for nodes that do not require format, we do not modify them
zsqw123
changed the title
ktlint indentRule has problems with ignoring braces
ktlint indentation rule has problems with ignoring braces
Sep 11, 2022
Expected Behavior
The following code should not be formatted
![image](https://user-images.githubusercontent.com/49520432/189515148-a9ad5783-d0ba-4160-8faa-a8a04aec7cb0.png)
Observed Behavior
But when I run
![image](https://user-images.githubusercontent.com/49520432/189515078-03e4077a-42f8-4674-a391-9a85255ac004.png)
ktlint -F
, I get the following.Steps to Reproduce
Your Environment
.editorconfig
Possible reasons
ktlint's indentation rule records the braces with a stack, and when I use
// ktlint-disable
on the line where the braces are, the indentation rule does not check thisASTNode
and the stack does not change, hence the problem.The text was updated successfully, but these errors were encountered: