Skip to content

Provide an option to disable import ordering or customize order #986

Description

@PatrickRen

I'm working on a project (Apache Flink) using AOSP format but with customized import ordering. I manually set the order in Preferences | Editor | Code Style | Java | Imports | Import Layout, but google-java-plugin will override my settings when I use "Optimize Imports".

Is it possible to provide an option to disable the feature, or let users to customize the import order? Thanks!

Activity

  1. AgNS61 commented on Nov 11, 2023

    @AgNS61

    Many teams use custom import ordering, but now this limitation drives us to use the 1.15.0 version. I hope this feature will come soon.

  2. nrayburn-tech commented on Aug 21, 2024

    @nrayburn-tech
    Contributor

    Should the other applicable CLI options also be exposed? This would allow using different options within the CLI and remaining consistent with the plugin. This would be beneficial when running a validation in CI to ensure code is formatted before merging. Currently, we are restricted to only what the plugin allows.

    At a glance, these all look like candidates.

    • fixImportsOnly
    • sortImports
    • removeUnusedImports
    • reflowLongStrings
    • formatJavadoc

    I can make a separate issue if that's preferred. Also, happy to contribute the changes if it's something that would be accepted.

  3. whitmabc commented on Oct 9, 2024

    @whitmabc

    On a team that even enforces import-order as a build step, fully preventing me from using this plugin until I have the option to exclude imports from the formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions