Skip to content

No way to refactor all files automatically #1820

Closed

Description

@clicktodev

I can only add missing package declarations on one file at a time. No way to fix all in one click.

Environment
  • Operating System: w10 1909
  • JDK version: 11
  • Visual Studio Code version:1.53.2
  • Java extension version:0.75.0
Steps To Reproduce
  1. missing package declaration: hover mouse over error and quick fix
  2. only option is to add package declaration to current file

[Please attach a sample project reproducing the error]
Please attach logs

Current Result
Expected Result
Additional Informations

Activity

  1. testforstephen commented on Mar 2, 2021

    @testforstephen
    Collaborator

    Can you share how you expect this FEATURE to be exposed to you?

  2. clicktodev commented on Mar 2, 2021

    @clicktodev
    Author

    I jut realized the post isn't clear enough. Basically there's no way to add all missing imports in a single file in a single click.
    I have to go through each missing import and add it using the quick fix.
    Also there's no way to add all missing imports for an entire project. I have to do each file at a time which is a huge pain tbh.

  3. fbricon commented on Mar 2, 2021

    @fbricon
    Collaborator

    For a single file, you can right click in the file -> source actions -> organize imports.
    Also bound to Shift+Alt+o

  4. fbricon commented on Mar 2, 2021

    @fbricon
    Collaborator

    You can also execute organize imports automatically on file save. Add this to your settings.json:

    "[java]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
  5. clicktodev commented on Mar 3, 2021

    @clicktodev
    Author

    Great, Is there a way to add all missing imports to the entire project without doing each file separately?

  6. rgrunber commented on Jan 18, 2022

    @rgrunber
    Member

    Great, Is there a way to add all missing imports to the entire project without doing each file separately?

    Not currently possible, but this is what #1107 is requesting. It has come up enough that it seems to be worth doing.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions