Skip to content

Commit

Permalink
Adjust .editorconfig for kotlinlang style for IntelliJ to better alig…
Browse files Browse the repository at this point in the history
…n with ktfmt (#412)

Summary:
Two changes:

1. Field annotations are set to wrap `off`, to align with ktfmt that places them on the same line as the field.

e.g.
```kotlin
    get:Input
    internal abstract val versionPropertyName: Property<String>
```
...will now match what ktfmt does:

```kotlin
    get:Input internal abstract val versionPropertyName: Property<String>
```

2. Import order; IntelliJ places java.*, javax.*, kotlin.* at the end, after other imports, whereas ktfmt places all imports in alphabetical order:
e.g.

```kotlin
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import java.util.*
import javax.inject.Inject
```

... will now be consistent with ktfmt, all sorted alphabetically.

```kotlin
import java.util.*
import javax.inject.Inject
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
```

Pull Request resolved: #412

Reviewed By: strulovich

Differential Revision: D49319451

Pulled By: hick209

fbshipit-source-id: f2b6a163cd18ae3ec2f82227b6dd2f18eea11098
  • Loading branch information
cloudshiftchris authored and facebook-github-bot committed Sep 18, 2023
1 parent 289f4bb commit 45e78e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/editorconfig/.editorconfig-kotlinlang
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ ij_kotlin_continuation_indent_in_supertype_lists = false
ij_kotlin_else_on_new_line = false
ij_kotlin_enum_constants_wrap = off
ij_kotlin_extends_list_wrap = normal
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_field_annotation_wrap = off
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = false
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = *
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 2
ij_kotlin_keep_blank_lines_in_code = 2
Expand Down

0 comments on commit 45e78e2

Please sign in to comment.