-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Don’t multi-line imports (let them take less space) / Conflict with VSCode’s organizeImports #5995
Copy link
Copy link
Open
Labels
lang:javascriptIssues affecting JSIssues affecting JSstatus:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken
Description
Hi.
There is a bug somewhere when builtin VSCode's source.organizeImports feature is used together with Prettier.
People sometimes prefer to use VSCode's built-in source.organizeImports feature ON SAVE which, among other things, places all imports on the same line. And this conflicts with Prettier when it formats imports at multiple lines: if there is an error in the code, the underlining of this error shifts towards beginning of the file.
I recorded a video which shows the effect, pretty easy to reproduce:
https://www.dropbox.com/s/apj5znzlqy8pub6/vscode-prettier.mp4?dl=0
There are two possible ways I imagine:
- Fix the bug somehow (I tried to find the root case, but failed unfortunately), so organizeImports + Prettier could work together.
- Introduce an option which allows to turn off imports indentation in Prettier (a quick PR: Add option neverIndentImports to skip import statements formatting #5991) - it's a work-around in some sense, but at the same time, having all imports on the same line is VSCode's default they evangelize, and Prettier in some sense goes against this default.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSstatus:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken