Remove trailing space oddity

Hello,

I have a small problem with the "remove trailing whitespace" feature.

The problem is with completely empty lines.

Let's say I have this PHP code:

if ($something){
    echo $something;
}

and now I'm adding a blank line and another line like this:

if ($something){
    echo $something;

    echo "foobar";
}


Then, after saving and regardless of the "remove trailing whitespace" setting, that blank line won't be blank, but it will contain four spaces.

Now git gets really pissy about that and so does the project maintainer (which is myself, I guess), so I'm asking here: What's the rationale for not removing trailing space if there's nothing else on the line? And of course: Can this be changed somehow? Or do I have to write a plugin (can a plugin even fix this - I'm a total noob to JetBrains' editors)?

Philip
3 comments
Comment actions Permalink

This looks like a bug. Please create new issue at http://youtrack.jetbrains.net/issues/WI

0
Comment actions Permalink

thanks a lot for the clarification. I reported it as http://youtrack.jetbrains.net/issue/WI-1039

For me, this issue is really important as I really, really can't have any trailing whitespace in files I commit. Because Web IDE is otherwise really cool, I'm currently still using it and feeding all files through some sed-action before commiting them, but I would still prefer to see this fixed before the final release as the process is juuust a bit error-prone on my end.

Or is there a way to very easily hook that sed-action into the general save-process as a work-around?

0
Comment actions Permalink

I can't actually think of an EASY way to fix it..

0

Please sign in to leave a comment.