Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm sync how to ignore line separators?

If I run a sync with a server I get changes in all files because of different line separators. All files show no changes but a hint: "contents have differences only in line separators".

Can I make PHPStorm ignore those line separators?

like image 313
PiTheNumber Avatar asked Dec 17 '14 11:12

PiTheNumber


People also ask

What are line separators?

The line separator used by the in-memory representation of file contents is always the newline character. When a file is being loaded, the line separator used in the file on disk is stored in a per-buffer property, and all line-endings are converted to newline characters for the in-memory representation.


1 Answers

Can I make PHPStorm ignore those line separators?

There is no such option.

Thing is: there is no difference in the actual content (code) but it is still there in line endings (which is still part of the "content").

https://youtrack.jetbrains.com/issue/IDEA-101502 -- star/vote/comment to get notified on progress. The ticket has been resolved since 2017.3 version.

You have to use Compare by: Text to ignore Line endings and charset:

enter image description here


Right now I may only suggest to convert all of your local PHP/HTML/JS files to the same line endings (Unix - LF) -- PHP (and browser) on Windows sees no difference between them when executing.

  • This option affects newly created files: Settings/Preferences | Editor | Code Style --> Line Separator
  • For existing files you have to perform such conversion manually: select files/folders (or whole project) in Project View panel and use correct entry from File | File Properties | Line Separators (used to be File | Line Separators in the past).
    ~ It is also possible to change that from the status bar: for a currently opened file of course.
like image 102
LazyOne Avatar answered Sep 20 '22 12:09

LazyOne