Double spacing!
Answered
hello,
I was working on some code at home using PHPStorm over the weekend. Today I came to work and download the code from my server to work on it locally. Every darn line is double spaced! This is HIGHLY annoying!!!
Now instead of being productive, I can start going over each file and remove the double spaces. X-(
I've checked in the prefs what it might be, but I was working on the code before at work and the lines were not double spaced. Anyone have a clue why is this? Is there a setting somewhere that I need to change for this? I checked under Code Style, but so far none of my tweaks resulted any changes. I even reset the Code Style settings and still my codes are double spaced.
Thanks.
Please sign in to leave a comment.
Hi there,
Please explain what do you mean by "double spacing" and how it should be instead (screenshots are welcome).
Sorry, double spacing meant line spacing. It means, when you press ENTER or RETURN at the end of the line, you will continue your code on the next line. I uploaded my code to my remote server last night, came to work, downloaded the files to work on them. Now, instead of a simple carriage return, there are extra 2 lines between EACH line of code.
I have no understanding as of why this happened. I've already went through my files and removed the extra lines.
I have just started using PHPStorm last week and ran into this issue, so naturally I was freaking out, since I don't want to work like this every day. Hope it was some minor issue.
I thought maybe this is a result of somehow the settings under the "Code Style" section ended up being different between my home and work machine...? But I have not changed the code style section in the settings so it puzzles me.
I see.
No idea what caused this -- but I doubt it was PhpStorm. As far as I remember this forum you are first one to report this. Maybe it is done by FTP server somehow? Can you download the same file using another client and see how it looks there?
Well, all the files on the server have double line spacings. That is NOT how I uploaded them - obviously. So something must've messed up during the upload. But PHPStorm was still displaying correct display format (line spacing).
I will have to check on this when I get home and will try to upload some test files.
If you can open such remote file in some kind of HEX editor -- please check what line endings actually are -- are they the same for all lines or they are of mixed type.
Also, if you open such file in another editor -- how it displays it?
BTW -- what PhpStorm version do you use exactly and what OS (Help | About)?
Ok, so I just checked my files and run tests.
The files that I'm uploading from PHPStorm have "0d 0d 0a" at the end. Which means the uploaded files end up with an extra "0d" at the end. I can reproduce this just by creating a simple file (any type) and just type something in it, then upload it from PHPStorm. The local files are good. They have "0d 0a" line endings. But the uploads have "0d 0d 0a".
I'm running PHPStorm 5.0.2 build PS-121-285 trial.
Windows 7 x64.
I'm trying to switch to another dev tool from DreamWeaver. That is what I've been using in the past few years, but when I use DW and upload the files using its built-in FTP thing, my files were always OK.
Even in the test case, I create a few lines of text, upload via PHPStorm. Then download the file and check. The lines are double spaced. Now I do the same, but upload the same file via DW, then download the file and check. The file is OK.
I've checked the remote host and deployment settings in PHPStorm, but I don't see any settings that would otherwise change my line endings at upload time.
OK. So your tests show that it is done by PhpStorm (somehow). I personally still have no clue what may cause this.
The next obvious step would be collecting FTP logs ( http://devnet.jetbrains.net/docs/DOC-1202 ) and submitting new ticket to the Issue Tracker along with any other relative information (unless someone has some solution already).
But before that we can check if it can be "fixed" by resetting all settings to their defaults. I suggest trying this:
P.S.
Apparently there was one person who had similar (?) issue, but no conclusions were made: http://youtrack.jetbrains.com/issue/WI-5259
Hello!
Here is related issue which is more descriptive. Currently all FTP file transfers are done in binary mode, which sometimes leads to creating extra or removing linebreaks. Normally transfer mode (binary or ascii) should be detected based on file type. It is a feature yet to implement. Please describe your client OS, server OS and FTP server here or in issue comment.
Elena Shaverdova
Thanks for the replies!
I can confirm that Elena is right. ASCII vs binary FTP transfer seems to be the problem.
Deleting the preferences files/folders and starting from scratch did not help. When I uploaded a text file to the server and then used FileZilla to download the file in ASCII mode, it give me double lines spacing. The same result I get using "auto" tranfer type - which is how it's normally set. However, setting the transfer to binary in FileZilla and downloading the file results in the correct line spacing.
I can also confirm this using Windows 7. Win 7 has the ability to map a network drive to an FTP site, which I did. It doesn't let me set transfer type options, but using Win 7, when I go to the FTP site and download it, I get the correct line spacing result. So somehow Win 7 knows that the file was transferred in binary mode and downloads it correctly.
PHPStorm 5.0.2 build PS-121-285
Local: Win 7 x64
Remote: Linux (don't know version, it's a hosted account), Apache 2.2.22
FileZilla 3.5.3
PS: Apparently there's an entry in the issue tracker already, so I didn't create a new one: http://youtrack.jetbrains.com/issue/WI-9103
Just a heads up to anyone else having this problem.
I fixed this by simply replacing all instances of \r\n\r\n with \r\n (CRLF line ending mode).
If your line endings are unix (\n) then \n\n with \n would probably work.
Same problem here. Files created in phpstorm and stored on Linux server were then copied (via windows) to USB SSD and then copied to laptop while on vacation. Everything is double line spaced.
@Dave Is FTP server also involved? Please vote for https://youtrack.jetbrains.com/issue/WI-9103 .