Skip to content

Import Sorting (Manual and Auto) not working on Laravel 9-12 #143

@Flavien-Panunzio

Description

@Flavien-Panunzio

Subject: Import Sorting (Manual and Auto) not working on Laravel 9 to 12

Description

I am experiencing an issue where the Sort Imports feature (both automatic on save and manual via command) is not functioning. While the namespace resolution and insertion work as expected, the alphabetical sorting of use statements is never triggered or has no effect.

Environment

  • Framework: Laravel (tested on versions 9, 10, 11, and 12)
  • PHP Version: 8.1 or higher
  • Extension Version: [Insert your version here, e.g., 1.1.9]
  • VS Code Version: [Insert your version here]

Steps to Reproduce

  1. Open any Laravel class (Controller, Model, etc.).
  2. Add several use statements in a completely scrambled order.
  3. Trigger the "Sort Imports" command manually or save the file with auto-sort enabled.
  4. Observed result: The imports remain in their original, unsorted order.
  5. Expected result: The use statements should be sorted alphabetically.

Additional Context

I have reproduced this across multiple Laravel projects from version 9 up to the upcoming/latest version 12.

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