1

PhpStorm is opening some files saved with LF as CRLF. I've got Editor > Code Style > Line separator: Unix and maxOS (\n) and I've now turned on Editor > Inspections > General > Inconsistent line separators so at least PhpStorm warns me as soon as it opens the file. But I can't find the setting that is automatically converting my line endings in the first place. I can tell it's PhpStorm doing this because Git shows no changes until the instant I open a file in PhpStorm.

In case you're wondering about my Git settings, I've got core.autocrlf=false in both my global and repository Git config, so it's not to do with Git.

How do I stop PhpStorm from automatically converting my line endings?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
CJ Dennis
  • 4,226
  • 2
  • 40
  • 69
  • 1
    `Editor > Code Style > Line separator:` -- this affects only brand new files created in PhpStorm + that inspection (that warns if it differs). It does NOT change your line endings automatically. Never did it here. It may normalize them on save (e.g. if you have mixed them in a single file .. but not change from one to another). Perhaps the file gets modified by some tool (e.g. check your File Watchers etc) that has different settings... What files are those (what language/technology)? – LazyOne Sep 22 '21 at 23:04
  • @LazyOne Any language. PHP, yaml, etc. – CJ Dennis Sep 23 '21 at 06:20
  • 1) Anything interesting in `.editorconfig` file (inside the project and way up to the root)? 2) Wil this behavious persist if you disable Editor Config support? `Settings/Preferences | Editor | Code Style | Enable EditorConfig support` 3) Check video (in attachments) in this ticket: anything similar to that? https://youtrack.jetbrains.com/issue/IDEA-225911. – LazyOne Sep 23 '21 at 16:11
  • @LazyOne I don't have an `.editorconfig` file. I've tried turning off Editor Config support, and I'll see if that makes a difference. – CJ Dennis Sep 24 '21 at 12:26
  • @LazyOne Nope! Turning off Editor Config support did not fix the problem. – CJ Dennis Sep 25 '21 at 03:45
  • If you say that you have no File Watchers; no Editor Config files / support enabled .. then I do not know. IMO this must be Git related... Last idea to check if you are on Windows: 1) get [ProcessMonitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) 2) launch it and configure to watch for files in that project (folder path) 3) Make sure that a file is OK before that (e.g. open it in another editor first) 4) With procMon active, open that file in IDE and check for changes / see what processes did write to that file. It may give some clues. – LazyOne Sep 25 '21 at 09:08
  • This must be yours as I understand: https://youtrack.jetbrains.com/issue/WI-63085 – LazyOne Sep 25 '21 at 10:47

0 Answers0