-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Use project / system line endings #61
Comments
Interesting idea, thank you. We will try and add something like this in the near future. |
|
That will help, but this issue proposes checking that the line endings match the project settings, not just that they are consistent within the file. |
It should not be very difficult to accommodate that, I will look into it. Or someone else may also participate, it is basically the issue off replacing any existing line endings in a file with a project specific ones. |
I'll have a go at implementing this, though haven't worked on PyCharm / Intellij plugins before |
@Zeckie Did you make any progress with this? Or can I implement this proposal by myself? |
Yes, happy for you to do that. I didn't have much success trying to narrow down what exactly was causing the issue. From looking at the code, it seems as though the responsibility for line ending type was with the intellij code, not this plugin. I also found that I couldn't reproduce this issue with just pycharm and this plugin, I needed to set up a filewatcher (eg running |
@Zeckie Interestingly, I tried to reproduce this using PyCharm 2022.2.3 with the current plugin and failed to trigger those inspections. I was using While code returned from blackd indeed has Can you please share your PyCharm version? |
@lensvol, I was able to reproduce this fairly reliably, but have installed some updates (and potentially made some minor changes to settings), and it does not seem to happen any more. I've installed some updates since originally reporting, now I'm using:
Plugins:
Python dependencies (
Configuration:
Steps that I was previously able to use to reproduce the issue:
from typing import (
Any, Any)
import re
a: Any = re.match(
"foo",
"bar")
Now, it seems as though something has changed at step 4 - after saving, it looks like only black runs, and the editor shows up as though it has not saved (the asterisk over the icon): If I turn off the I saw this in
|
I have also been able to get the same error (from Inconsistent line separators inspection) without BlackConnect installed, by doing the following:
|
@Zeckie Given your findings that this can be reproduced without BlackConnect, I would assume the issue is not really related to plugin? |
@lensvol, yes that makes sense - looks to me as though it is either an issue with File Watchers plugin or some internals of PyCharm (https://youtrack.jetbrains.com/issue/PY-58254/Line-endings-incorrectly-changed-on-conflict-between-changes-in-editor-and-file-watcher) There does still appear to be an issue with this plugin, but I think it is different enough to warrant a new issue:
|
Previously, blackd always used \n (Unix / Linux style) line endings, even on Windows.
When I am using this plugin, and make changes that result in black changing the formatting, I get this warning in PyCharm;
I am using these PyCharm settings (on Windows):
This plugin should use the PyCharm / IDEA line separator setting, and either pass that configuration to blackd, or convert the line endings when black makes any changes.
The text was updated successfully, but these errors were encountered: