[isort] support for configurable import section heading comments#23151
[isort] support for configurable import section heading comments#23151amyreese merged 27 commits intoastral-sh:mainfrom
isort] support for configurable import section heading comments#23151Conversation
|
|
thanks @ntBre for approving the tests to run. I've pushed an update now to fix the clippy warnings etc. |
|
No problem! It looks like you just need to accept a few configuration snapshot changes and regenerate the JSON schema. I'll try to give this a review soon. (I think the |
...__rules__isort__tests__import_heading_already_present_import_heading_already_present.py.snap
Outdated
Show resolved
Hide resolved
amyreese
left a comment
There was a problem hiding this comment.
Why are the ty snapshots changing?
ntBre
left a comment
There was a problem hiding this comment.
Thank you! This looks good to me overall, I mostly had very minor comments. I think trying to use the Tokens and double-checking the duplicate heading handling are the most significant.
astral-sh#23151 (comment) Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
astral-sh#23151 (comment) Co-authored-by: Amethyst Reese <amethyst@n7.gg>
astral-sh#23151 (comment) Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
astral-sh#23151 (comment) Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
astral-sh#23151 (comment) Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
astral-sh#23151 (comment) (might need to add a & ref to make this compile, will check locally) Co-authored-by: Amethyst Reese <amethyst@n7.gg>
…ies field when running locally with `cargo dev generate-all`
…rties are not missing when we run `cargo dev generate-all`
…icate header comments see: astral-sh#23151 (comment)
…re properties are not missing when we run `cargo dev generate-all`" This reverts commit e3794e7.
isort] support for configurable import section heading comments
* main: (209 commits) [ty] Defer base inference for functional `type(...)` classes (#22792) flake8-executable: allow global flags in uv shebangs (EXE003) (#22582) [ty] Add `replace-imports-with-any` option (#23122) Update html comments in mdtests (#23269) Apply ruff formatting to mdtests (#22935) [ty] Exclude test-related symbols from non-first-party packages in auto-import completions [ty] Refactor `CursorTest` helper to support site-packages [ty] Qualify inlay hint edit symbol when possibly referencing another variable (#23265) [ty] Avoid `UnionBuilder` overhead when creating a new union from the filtered elements of an existing union (#22352) [ty] Refactor TypedDict key assignment validation (#23262) [ty] Improve Python environment path documentation (#23256) [ty] loop control flow analysis using loop header definitions Prepare for 0.15.1 (#23253) Remove docker-run-action (#23254) [ty] Allow discovering dependencies in system Python environments (#22994) Ensure pending suppression diagnostics are reported (#23242) [`isort`] support for configurable import section heading comments (#23151) [ty] Fix method calls on subclasses of `Any` (#23248) [ty] Fix bound method access on `None` (#23246) Make range suppression test snapshot actually useful (#23251) ...
Summary
fixes #6371
settings.rs- Added import_headings: FxHashMap<ImportSection, String> field to Settings struct with default and display supportoptions.rs- Added import_heading configuration option with #[option] metadata, documentation, and TOML table syntax. Added validation for unknown sections and mapping to Settingsmod.rs- Core logic in format_import_block:organize_imports.rs- Extended fix range backward to include heading comment lines above the first import, preventing duplication on fix applicationTest Plan
Test Coverage (9 new tests, 156 total passing)