Kotlin / kotlinx-rpc

Add asynchronous RPC services to your multiplatform applications.
https://kotlin.github.io/kotlinx-rpc/
Apache License 2.0
702 stars 16 forks source link

Replace consequent `write` and `newLine` calls on CodeWriter with `writeLine` #69

Closed jvmusin closed 4 months ago

jvmusin commented 4 months ago

Subsystem KSP plugin.

Problem Description The code in RPCClientServiceGenerator would be easier to follow if it had no duplicated write and newLine methods which always go together.

Solution Introduce fun CodeWriter.writeLine(str: String) which does writing given text and a newline character. Since all the write method usages are followed by the newLine method call, the code becomes easier to read. As a bonus, the write method is not used anymore and can be removed.

The changes in this commit do not change the file being written except for the final newline character. Previously, generated files did not contain a newline character, and now they will.

Mr3zee commented 4 months ago

@jvmusin Thanks for the first contribution! This does indeed make the code more readable I'll approve the changes once CI check are complete