android [nfc]: Auto-format Kotlin code; apply "recommended" style settings#5267
Merged
chrisbobbe merged 6 commits intozulip:mainfrom Mar 2, 2022
Merged
android [nfc]: Auto-format Kotlin code; apply "recommended" style settings#5267chrisbobbe merged 6 commits intozulip:mainfrom
chrisbobbe merged 6 commits intozulip:mainfrom
Conversation
Member
Author
|
Not sure quite what keystroke I hit that caused the PR to be created while I was still typing the title. Anyway, description all written now. |
This simplifies future editing on these files, by letting auto-format be used freely without adding unrelated changes to diffs. Done like so: * In the breadcrumb list while I had open some file under android/app/src/main/, right-clicked on that directory and chose "Reformat Code". * Left "Optimize imports" unchecked; we'll do that separately. * Left scope at "All files", unfiltered. * After running that, reverted changes to XML files (I might try tweaking those format settings before rerunning there), and indentation changes to Java files (ditto; and if we contemplate big changes to those files we should just convert them to Kotlin.)
Following a prompt in Android Studio, which read:
Kotlin code style: Do you want to update your Kotlin code style
settings to the recommended ones?
Conveniently, this doesn't change much code of ours.
This avoids these blending in with the definitions inside the class.
With Android Studio, applied to the whole android/app/src/ tree.
This comes from using the "Reformat Code" dialog box, and this time checking the "Cleanup code" (sic) box. Most of these look like small formatting changes; I don't really understand why reformatting before without that box checked didn't already cover those. Well, whatever.
14a1005 to
4d6b656
Compare
Contributor
|
LGTM, thanks! Merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'd been getting a prompt each time I opened Android Studio recently, reading:
Sure, why not. Also take this as an occasion to get all our Kotlin code auto-format-clean; not much changes.
And while looking at the code-style settings, I discovered there is a setting to enable trailing commas! 🎉 Enable that, too.