Ruff in vscode deletes some of my files when I press `ctrl-s`, and "on-type" setting is enabled
melund opened this issue · 6 comments
Ruff in vscode deletes some of my files when I press ctrl-S.
Here is a small video showing it.
Untitled.video.-.Made.with.Clipchamp.mp4
I press "Enter" a few times, then "Ctrl-s". Then the file is then cleared.
Afterwards I need to press "ctrl-z" two times to undo, and then repeat to trigger the issue again.
Changing settings in vs-code from "On-type" to "On-save" seems to fix the problem for me.
Hi! Sorry about that. Are you on the latest version of everything?
Also, can you confirm if you're on the pre-release version or the stable version of the extension. If you're on pre-release, then are you using the new ruff server
?
Do you have any other extensions alongside Ruff that modify code? E.g., do you have the isort extension installed? There are some bugs in VS Code itself around this.
Also, can you confirm if you're on the pre-release version or the stable version of the extension. If you're on pre-release, then are you using the new ruff server?
I was on the default version: v2024.20.0
Do you have any other extensions alongside Ruff that modify code? E.g., do you have the isort extension installed? There are some bugs in VS Code itself around this.
I did actually have the isort
extension without being aware of it. It probably came with microsoft's python extension bundle. I have removed those things, and ensured that the ruff extension uses it own 'bundled' ruff version.
I have tried a lot to see if I could figure out what really triggered it. But no success. Fell free to close the issue.
A Charlie mentioned it's a known issue that VSCode will delete file contents when multiple plugins attempt to apply changes. Sounds like you've got it sorted out now! Thanks for investigating.