The phpstorm change Line endings
Hello,
There are some php files which CRLF and LF are mixed up in my project.
If I put only one line in these files and check "git diff", I can see so many diff that I've never touched at all.
Whether I do it by CRLF or LF, the result is same.
On the other hand, If I do the same work in VIM, it's totally fine. no diff except the part I modified.
I think PHPStorm change the line endings,
so I set "System-Dependent" as the value for Line separator(Setting->Editor->Code Style), But it doesn't work.
what else I can do? It is really annoying and I don't want to make any diff in the part I didn't revise.
I look forward to your help..
Best regards
Please sign in to leave a comment.
Hi there,
>I think PHPStorm change the line endings,
Mixed line endings in a single file?
That's right -- in files with mixed line endings IDE will use just one -- the first line ending it detect on file opening.
>so I set "System-Dependent" as the value for Line separator(Setting->Editor->Code Style), But it doesn't work.
AFAIK this affects newly created files only -- should not affect existing files in ANY way
If you need to manually change line ending for an existing file -- use "File | Line Separators" or vis Status bar to change it
>what else I can do? It is really annoying and I don't want to make any diff in the part I didn't revise.
AFAIK -- nothing in this IDE (although I could be wrong on this).
I may only suggest to spend some time and do dedicated PR that would bring files with multiple line endings to be the same style.
Related tickets (check them):
I had this problem on 2 different computers, using editing files from SFTP server using WinSCP.
And the problem was solved, by changing WinSCP files transfer settings from "text" to "binary".
Otherwise - line endings were changing every time we edit file on different computers. I suppose - the transfer settings can be any, just need to be the same.