Skip to content

Feature Proposal: Grouped Import Sorting in Typstyle (Similar to Python’s isort) #212

@Enter-tainer

Description

@Enter-tainer

generated by genai from unstructured chat logs

Issue Description

Currently, Typstyle does not have any functionality for sorting imports. This can lead to inconsistent and disorganized import statements in code, reducing readability and maintainability. This proposal suggests adding import sorting to Typstyle, similar to tools like Python’s isort, to automatically organize imports in a consistent and logical manner.

Proposed Feature

Implement an import sorting feature that:

  1. Sorts Imports Alphabetically: Orders import statements alphabetically.
  2. Groups Imports (Optional): Allows imports to be grouped logically (e.g., standard library, third-party, local modules) with empty lines separating groups.

Implementation Considerations

  1. Basic Sorting:
    • Sort all imports alphabetically by default.
    • Handle both import and from ... import statements.
  2. Grouping (Optional):
    • Detect and group imports by type (e.g., standard library, third-party, local modules).
    • Separate groups with empty lines.

cc @QuadnucYard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions