-
Notifications
You must be signed in to change notification settings - Fork 334
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
FixAll on save doesn't pick up file change from organize imports #939
Comments
Here's the ESlint trace of what happens: VS Code update the document using organize imports (removing the trailing comma)
VS Code request code actions for fix all
ESlint updates it's diagnostics
ESLint then returns no code actions
|
I looked into this and for me it looks like this: TypeScript and ESLint do have two conflicting fixes for the organize import.
I don't see how ESLint can address this. @mjbvz and @JacksonKearl can you please outline what in your opinion ESLint should do to avodi this? |
This conflicting behavior results in the fact that the import switches on every Save. |
There is something else wrong as well since I see this in the console:
|
The problematic piece seems to be
I always thought the format is
|
Change the settings to
basically avoid printing the
|
To make things clear: I fixed the fact that the setting was not read correctly. However the sertup itself still doesn't result in a user friendly behaviour :-). But IMO there is nothing ESLint can do to address this. |
The idea with #88131 was to allow
If instead you use:
The If however we use the array syntax, it should run organize imports, converting the working copy to have organized imports but not be eslint conformant, then immediately run eslint, preserving the order of the imports but not their formatting, and making the document eslint conformant. And only then should it be persisted to disk. What I'm observing instead is that I save one time and the organizeImports output is written to disk. Then I save again and the eslint output is written to disk. And it keeps alternating between these two.
All eslint should need to do is the same formatting it has always done, the input will be organizeImports conformant but the output doesn't need to be. @mjbvz maybe organize imports could be changed to not care about formatting, only order? So if the imports are in correct order it doesn't touch them and we don't get flicker. |
Thanks for the details @JacksonKearl. That is correct @dbaeumer I was surprised to see that changing |
@mjbvz the current reason left is settings migration for which we don't have any store in VS Code except that the extension does it itself. |
From microsoft/vscode#88131 (comment)
Repro
Clone https://github.com/JacksonKearl/eslint-organizeImports-codeactions
This sets:
Open
index.ts
and save the file a few timesBug
Notice the trailing command being added and removed on each save
The text was updated successfully, but these errors were encountered: