import-js
import-js copied to clipboard
Bug: `maxLineLength` breaks some imports
I have set maxLineLength
to some large value (say 999) so that all imports are in one line.
Now when I have a file where I want to auto-import, and any of the imports are available from multiple sources, the plugin will ask me from where to import it (as expected).
However, after choosing the source of import, instead of adding it to the line with existing imports from that file, it will remove that line altogether.
Intersting, this only happens when maxLineLength is large?
I’m out on vacation right now, so I can’t do much about this bug. If you have the bandwidth to fix, I’m happy to review a PR from the poolside. ☀️
It only happens if 2 conditions are met:
-
maxLineLength
is set to a value large enough that all imports from given file/module would fit in one line - import from that file/module is also available from another source so we get a question asking from which source to import
Now thinking about it I am using this app via Visual Studio Code plugin so it might be possible that it's plugin's fault? I will have to investigate further. I might also work on a fix if I find few minutes spare :) Will keep you updated, enjoy your holidays in the meantime :)
It’s possible but highly unlikely that the line is removed on the visual studio plugin side. All plugins are implemented in a way that hands over most control to the importjs daemon.
It looks like I was wrong about where this bug is. I've managed to reproduce it with the vscode extension, and I went ahead and filed a report in that project: https://github.com/dabbott/vscode-import-js/issues/6