Skip to content
This repository was archived by the owner on Oct 16, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions style.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,15 @@ The prime directive of line-wrapping is: prefer to break at a **higher syntactic
* the dot separator (`.`)
* the two colons of a member reference (`::`)
2. When a line is broken at an _assignment_ operator the break comes _after_ the symbol.
3. A method or constructor name stays attached to the open parenthesis (`(`) that follows it.
3. A method or constructor name stays attached to the opening parenthesis (`(`) that follows it.
4. A comma (`,`) stays attached to the token that precedes it.
5. A lambda arrow (`->`) stays attached to the argument list that precedes it.
6. A closing parenthesis (`)`) stays attached to the token that precedes it if the corresponding opening parenthesis (`(`) is on the same line.
7. A closing parenthesis (`)`) on a different line than its corresponding opening parenthesis (`(`) is placed on a line by itself indented the same amount as the line with the opening parenthesis.
* Exception: If the closing parenthesis is immediately followed by an opening curly brace (`{`), the open brace is placed on the same line as the closing parenthesis separated by a space.

Note: The primary goal for line wrapping is to have clear code, _not necessarily_ code that fits in the smallest number of lines.


### Continuation indent

When line-wrapping, each line after the first (each _continuation line_) is indented at least +8 from the original line.
Expand Down Expand Up @@ -349,7 +351,7 @@ Multiple consecutive blank lines are permitted, but not encouraged or ever requi

Beyond where required by the language or other style rules, and apart from literals, comments, and KDoc, a single ASCII space also appears in the following places only:

1. Separating any reserved word, such as `if`, `for`, or `catch` from an open parenthesis (`(`) that follows it on that line.
1. Separating any reserved word, such as `if`, `for`, or `catch` from an opening parenthesis (`(`) that follows it on that line.

```kotlin
// WRONG!
Expand Down