-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bug: Sort on Save garbles current file when refactoring #65
Comments
interesting issue. I've tried to recreate it on my side but wasn't able to. Could you share the exact scenario where you're seeing this behavior? |
Hope this helps |
Came to report the same. Extension is awesome, but I figured I'd check if there's a fix before I give up on it. I hit the issue mainly when refactoring. It's hard to tell exactly when since the imports change at the top of the file not where I'm at. But I think it's related to renaming functions or classes. It looks like it's copying sorted imports from different file. |
Observation: It's definitely happening often when using the VSCode right click, Rename Symbol (F2). It also doesn't appear to be copying an existing set of imports from another file. I also always get a lot of imports. Theory: When you rename an item that exists in multiple files, it renames and saves all those files. I believe the import statements from all of the files referenced are all sorted and added to just the current open file. So if a given item that's renamed exists in 3, 4, or more files, a lot of imports get added to the existing file. |
1st: love the ext, love the sort on save feature.
But I had to switch it off - too annoying too often. If I e.g. rename a function, I get a block of imports (most probably the last sorted ones) on top of current file - often leads to a lot of confusing project errors. I can Cmd-Z it away, but it totally breaks my flow.
Here is what I think happens: The refactor does an auto-save itself. Somehow import-sorter is hooked in and applies cached imports. It may only apply, if multiple files get changed thru the refactoring.
Please fix :)
The text was updated successfully, but these errors were encountered: