Open MRossa157 opened 4 months ago
Uff, that's not good. Do you roughly remember what you were adding when this happened? I suspect that this is an issue with range formatting because this isn't happening when I paste your example into the playground.
Uff, that's not good. Do you roughly remember what you were adding when this happened? I suspect that this is an issue with range formatting because this isn't happening when I paste your example into the playground.
I didn't add anything to Ruff, rather I replaced the black formatter with Ruff's. In addition to the usual Ruff setup, I also added Jupiter Notebook support (it's in the settings). And that's pretty much it. I don't remember any other additions.
Here is the list of extensions that I have installed in VS Code:
- autoDocstring
- Better Comments
- Black formatter
- Dev containers
- Docker
- IntelliCode
- isort
- Jupiter (and other Jupiter extensions)
- Makefile tools
- Python (include Pylance, Python debugger e.t.c)
- Python intend
- Python path
- Rainbow brackets
- Ruff[!!!]
- VS Code great icons
Thanks for sharing the additional data. Do you remember the changes you made to that file? I assume you made some edits, hit save and VS code formatted the code.
@charliermarsh I think there have been instances where Ruff and the isort extension don't get along. Any chance that might be related?
It could. If you have both extensions installed, code is often repeated at the bottom of the file. It's a bug in VS Code itself: https://github.com/microsoft/vscode/issues/174295
Thanks for sharing the additional data. Do you remember the changes you made to that file? I assume you made some edits, hit save and VS code formatted the code.
@charliermarsh I think there have been instances where Ruff and the isort extension don't get along. Any chance that might be related?
Yes, it is. I copied that code, pasted it and pressed CTRL + S (save file) and since I have it set to format on save, it formatted itself. I thought I had described it explicitly, sorry
Yeah, I think you either need to uninstall isort or disable Ruff's import formatting. This issue arises when you have multiple extensions installed that want to handle import formatting. In that case, VS Code ends up running them over one another, leading to contents duplicated like this.
This bug was on Ruff version ruff 0.4.7 and also on ruff 0.4.8
When I format this code:
Ruff makes this:
He is adding new (extra)
return
:My VS code settings (settings.json):