Formatter: Remove spaces before question mark in nullable types (KT-12830)
#KT-12830 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
9a50e91cd8
commit
0320bd8184
@@ -7,6 +7,12 @@
|
|||||||
|
|
||||||
## 1.0.4
|
## 1.0.4
|
||||||
|
|
||||||
|
### IDE
|
||||||
|
|
||||||
|
###### Issues fixed
|
||||||
|
|
||||||
|
- [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types
|
||||||
|
|
||||||
## 1.0.3
|
## 1.0.3
|
||||||
|
|
||||||
### Compiler
|
### Compiler
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
|
|||||||
|
|
||||||
beforeInside(INITIALIZER_LIST, ENUM_ENTRY).spaces(0)
|
beforeInside(INITIALIZER_LIST, ENUM_ENTRY).spaces(0)
|
||||||
|
|
||||||
|
beforeInside(QUEST, NULLABLE_TYPE).spaces(0)
|
||||||
|
|
||||||
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, DESTRUCTURING_DECLARATION_ENTRY, FUNCTION_LITERAL)
|
val TYPE_COLON_ELEMENTS = TokenSet.create(PROPERTY, FUN, VALUE_PARAMETER, DESTRUCTURING_DECLARATION_ENTRY, FUNCTION_LITERAL)
|
||||||
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
|
beforeInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_BEFORE_TYPE_COLON) }
|
||||||
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
|
afterInside(COLON, TYPE_COLON_ELEMENTS) { spaceIf(kotlinSettings.SPACE_AFTER_TYPE_COLON) }
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
fun foo(): String? = ""
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun foo(): String ? = ""
|
||||||
@@ -433,6 +433,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("NullableType.after.kt")
|
||||||
|
public void testNullableType() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/NullableType.after.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ObjectInBody.after.kt")
|
@TestMetadata("ObjectInBody.after.kt")
|
||||||
public void testObjectInBody() throws Exception {
|
public void testObjectInBody() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ObjectInBody.after.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ObjectInBody.after.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user