Android Studio:外部块范围的注释更改缩进

问题描述 投票:0回答:0

Android Studio 火烈鸟 | 2022.2.1 语言:科特林

问题: 最好只展示,但我会在之后添加一个快速解释。

// Some Comment
class SomeClass() {
....// Normal Comment/Code Auto Indentation
....val someVariable = "Value"
}

但是,如果某些评论被制表符抵消..

....// Some Comment
class SomeClass() {
........// Abnormal Comment/Code Auto Indentation
....// <-- Expected Indent, but not what is given
....val someVariable = "Value"
........// Doesn't matter if it is after/before a variable at correct Indentation
........// (Though, error does not occur with a completely empty block of code)
}

如果代码块/类为空,则问题不会发生

....// Some Comment
class someClass() {
....// Produces Normal Indent
....var someVariable = "Value"
........// However, as soon as there is more code, the indent changes
}

问题是它是根据块外的评论缩进的。 无论制表符/空格的数量如何,在块范围内缩进都不会影响块范围内的任何缩进。 这只发生在函数、类等中,其中注释是直接在块范围之前的 '//' 注释并且没有额外的空行。

有什么办法可以解决这个问题吗? 我已经尝试了所有组合 设置->代码风格->Kotlin->代码生成->注释代码, 例如禁用“第一列行评论”和“第一列阻止评论”。

android-studio ide indentation spacing auto-indent
© www.soinside.com 2019 - 2024. All rights reserved.