Open DrummerSi opened 4 years ago
This is unexpected, the last known behaviour is that the tool assumes a comment above an import is part of the import itself. More info at #20
I cannot reproduce it, I pasted your code in a new file and sorting the imports moves the comment with the import, not below.
Can you disable all other extensions and try again? What sorting style are you using?
I've re-tested it.. Using a new Virtual Machine, a new install of the latest VSCode, and only the 'vsc-sort-imports' plugin installed. All options were left as default. issue still occurs:
See image: https://i.imgur.com/dzvfBvJ.gif
does the same thing happen if you install import-sort-cli (v6) directly and run it against the file?
Indeed, the same thing happens when just running the CLI https://i.imgur.com/daP6i3U.png
If the CLI does it too then it's not an issue of this extension but of the core import-sort
. I found this issue related, what line endings are you using? can you try with LF line endings?
Yes, I can reproduce it by changing my line endings from LF to CRLF.
This issue can be fixed by changing the file line endings to LF.
That said, this should work with any line endings and we should notify renke/import-sort and try to help them fix it.
I never thought about the line endings. Glad we got to the bottom of it.. And I can see you've commented on the open issue you found. Hopefully they can get it fixed soon :)
When given the following import:
the plugin auto-sorts and removes comments, so it looks like this:
This will break the the server import though, as there are no typescript definitions for it