X Tutup
The Wayback Machine - https://web.archive.org/web/20220410122041/https://github.com/microsoft/TypeScript/pull/48330
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically create sort groups based on newlines in organize imports #48330

Merged

Conversation

Copy link
Contributor

@MQuy MQuy commented Mar 19, 2022

Closes #41494.

Based on @RyanCavanaugh's suggestion #41494 (comment)

when organizing imports in each block of newline-contiguous

import c from "C";

import d from "D";
import a from "A";
import b from "B";

turns into

import c from "C";

import a from "A";
import b from "B";
import d from "D";

@typescript-bot

This comment was marked as outdated.

@typescript-bot typescript-bot added the For Uncommitted Bug label Mar 19, 2022
@MQuy MQuy force-pushed the feature/create-sort-groups-by-newlines branch from ff8df38 to b89f697 Compare Mar 19, 2022
@sandersn sandersn added this to Not started in PR Backlog via automation Mar 28, 2022
@sandersn sandersn moved this from Not started to Waiting on reviewers in PR Backlog Mar 28, 2022
@typescript-bot typescript-bot added For Backlog Bug and removed For Uncommitted Bug labels Mar 28, 2022
Copy link
Member

@jakebailey jakebailey left a comment

This looks about right to me, but I think what I'd like to see are a few more tests to cover cases where there are comments, e.g., what is the behavior when we have something like:

// polyfill
import "lib"
// not polyfill
import { b } from "lib2"

or say

import "lib" // xyz

import c from "C"

Or similar (this isn't exhaustive). I know the original issue had some code snippets that feature comments.

src/services/organizeImports.ts Outdated Show resolved Hide resolved
src/services/organizeImports.ts Outdated Show resolved Hide resolved
src/services/organizeImports.ts Outdated Show resolved Hide resolved
src/services/organizeImports.ts Outdated Show resolved Hide resolved
PR Backlog automation moved this from Waiting on reviewers to Waiting on author Mar 28, 2022
@MQuy MQuy force-pushed the feature/create-sort-groups-by-newlines branch from fd96817 to 2c13fec Compare Mar 28, 2022
src/services/organizeImports.ts Outdated Show resolved Hide resolved
src/services/organizeImports.ts Outdated Show resolved Hide resolved
src/services/organizeImports.ts Outdated Show resolved Hide resolved
@MQuy MQuy force-pushed the feature/create-sort-groups-by-newlines branch from aa759f0 to 24e4cd9 Compare Apr 5, 2022
@MQuy MQuy force-pushed the feature/create-sort-groups-by-newlines branch from f594067 to bd8ce22 Compare Apr 5, 2022
src/services/organizeImports.ts Outdated Show resolved Hide resolved
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
src/services/organizeImports.ts Outdated Show resolved Hide resolved
PR Backlog automation moved this from Waiting on author to Needs merge Apr 5, 2022
@jakebailey jakebailey merged commit 6e0447f into microsoft:main Apr 5, 2022
10 checks passed
PR Backlog automation moved this from Needs merge to Done Apr 5, 2022
@DanielRosenwasser DanielRosenwasser changed the title [Feature] - Automatically create sort groups based on newlines Automatically create sort groups based on newlines in organize imports Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug
Projects
PR Backlog
  
Done
Development

Successfully merging this pull request may close these issues.

4 participants
X Tutup