Skip to content

Request: for "Reformat file" on save, please prevent it in case it changes logic or when the code has errors #430

@AndroidDeveloperLB

Description

@AndroidDeveloperLB

Describe the solution you'd like

Suppose I have these settings:

image

On Java and especially on Kotlin, when I leave the IDE in the background (pressing Home key, for example), it sometimes auto-formats when it shouldn't.

For example in this case of Kotlin, it's really annoying, as I haven't finished writing what's on the line with the "notificationManager." :

fun foo(context: Context, notification: Notification) {
    val notificationManager = NotificationManagerCompat.from(context)
    notificationManager.
    notificationManager.notify(123, notification)
}

It becomes this way:

fun foo(context: Context, notification: Notification) {
    val notificationManager = NotificationManagerCompat.from(context)
    notificationManager.notificationManager.notify(123, notification)
}

See video:

studio64_2023-05-10_12-21-25.zip

And sample:

My Application.zip

Please have some option to avoid it. Maybe even turn it on by default.

For what product
Intellij (Android Studio)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions