-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Line break at file end can't be added by PyCharm when running the Ruff plugin #149
Comments
@simonpercivall |
Weird, I've verified it on different computers with several projects. But it is inconsistent, in that in one case it does add the line break, but leaves the file in an "unsaved changes" state.
|
@simonpercivall |
Well, thanks for checking! I guess it's some interaction between different PyCharm plugins. I do wonder, is the plugin getting the changed text back or running |
PyCharm invokes the plugin's method with the file's text to reformat before saving the file.
I feel it's big changes 😅 |
Describe the bug
I think this is some weird interaction / race condition between PyCharm and the Ruff plugin running ruff on save.
Running the Ruff plugin on save removes the line break PyCharm is trying to add the the end of the file.
To Reproduce
Editor->General->Ensure every saved file ends with a line break
,\n
at the end, everything works as expected (i.e. there's nothing weird going on). But, if I remove that line break, and (with the cursor at some other line) try to save, the line break gets added and then immediately removed, and the file is marked as having unsaved changes (see the flashing4
in the gif).Expected behavior
A line break is added at the file end, and the file is saved.
Screenshots

Environments (please complete the following information):
The text was updated successfully, but these errors were encountered: