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

Incorrect backtick imports order #1445

Closed
BraisGabin opened this issue Apr 4, 2022 · 3 comments
Closed

Incorrect backtick imports order #1445

BraisGabin opened this issue Apr 4, 2022 · 3 comments

Comments

@BraisGabin
Copy link

Expected Behavior

If I reformat a file with IntelliJ/AS and then I reformat it with ktlint they don't do/undo the same change.

Observed Behavior

When I format my code with IntelliJ thse imports are ordered like this:

import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.instanceOf

But with ktlint they are ordered like this:

import org.hamcrest.CoreMatchers.instanceOf
import org.hamcrest.CoreMatchers.`is`

Your Environment

  • Version of ktlint used: 0.45.1
@paul-dingemans
Copy link
Collaborator

Yes indeed. The backticks are ignored when sorting the imports. This was a conscious change. But I did not knew it conflicts with IntelliJ sorting. I will mark the issue as such.

@paul-dingemans paul-dingemans added conflict-with-default-intellij-formatting Code produced by KtLint is not accepted by the IntelliJ default formatter import-ordering rule labels Apr 4, 2022
@krisgerhard
Copy link

krisgerhard commented Apr 14, 2022

This is an IntelliJ bug. Fixed in 2022.1.
Related GitHub and YouTrack issue: JetBrains/intellij-community#1879

image

@paul-dingemans
Copy link
Collaborator

@krisgerhard Tnx for reporting back with reference ;-).

@paul-dingemans paul-dingemans removed the conflict-with-default-intellij-formatting Code produced by KtLint is not accepted by the IntelliJ default formatter label Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants