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:
- Sorts Imports Alphabetically: Orders
import statements alphabetically.
- Groups Imports (Optional): Allows imports to be grouped logically (e.g., standard library, third-party, local modules) with empty lines separating groups.
Implementation Considerations
- Basic Sorting:
- Sort all imports alphabetically by default.
- Handle both
import and from ... import statements.
- Grouping (Optional):
- Detect and group imports by type (e.g., standard library, third-party, local modules).
- Separate groups with empty lines.
cc @QuadnucYard