indent assignment statement expressions properly
This commit is contained in:
parent
19b0b09826
commit
4e1022d726
1 changed files with 17 additions and 1 deletions
|
@ -107,16 +107,32 @@ private fun getIndentBasedOnParentType(
|
||||||
if (parentType == ASM_EXPR &&
|
if (parentType == ASM_EXPR &&
|
||||||
childType != KEYWORD_ASM &&
|
childType != KEYWORD_ASM &&
|
||||||
childType != KEYWORD_VOLATILE &&
|
childType != KEYWORD_VOLATILE &&
|
||||||
!childType.isParen)
|
!childType.isParen
|
||||||
|
)
|
||||||
return normalIndent
|
return normalIndent
|
||||||
|
|
||||||
//Assembly params
|
//Assembly params
|
||||||
if (parentType == ASM_INPUT_LIST || parentType == ASM_OUTPUT_LIST)
|
if (parentType == ASM_INPUT_LIST || parentType == ASM_OUTPUT_LIST)
|
||||||
return spaceIndent(2)
|
return spaceIndent(2)
|
||||||
|
|
||||||
|
//Variable declarations
|
||||||
|
if (parentType == VAR_DECL_EXPR_STATEMENT &&
|
||||||
|
(childType == PLACEHOLDER ||
|
||||||
|
child?.treePrevNonSpace?.elementType == EQUAL)
|
||||||
|
)
|
||||||
|
return normalIndent
|
||||||
|
|
||||||
return noneIndent
|
return noneIndent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val ASTNode.treePrevNonSpace: ASTNode? get() {
|
||||||
|
var it = this.treePrev
|
||||||
|
while (it?.elementType == TokenType.WHITE_SPACE) {
|
||||||
|
it = it.treePrev
|
||||||
|
}
|
||||||
|
return it
|
||||||
|
}
|
||||||
|
|
||||||
private val normalIndent: Indent get() = Indent.getNormalIndent()
|
private val normalIndent: Indent get() = Indent.getNormalIndent()
|
||||||
|
|
||||||
private fun spaceIndent(spaces: Int) = Indent.getSpaceIndent(2)
|
private fun spaceIndent(spaces: Int) = Indent.getSpaceIndent(2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue