css: don't insert whitespace after left brace

whenever i type:


and hit 'Tab', phpstorm correctly auto-completes 'position', but inserts whitespace before, so i get:

.test{ position:

i can't find an option to disable this. is it even possible?


Hi Matthias,

Works fine for me -- IDE does not add any spaces automatically on code completion (checked with PhpStorm v6 EAP build 124.373)

Try resetting settings to their defaults (at very least try Default code style scheme).


thanks for that quick reply!
alright, i just found it only happens under certain cirumstances, that is, when tabbing to get the very first option in the suggestion list (having typed 1 character only) - and only for SOME of these...

type .test{p
suggestion list appears, first entry is 'p (padding...;)'
hit 'tab'
result: .test{ padding:;}

typing 'pa' and hitting 'tab' then doesn't insert the empty character after the brace.
is this considered a bug?


Hi Matthias,

It's not a bug at all (at very least in my opinion) -- it's how multiple parts works together.

Lets have a look at this screenshot when you attempt .test{p| (where | is a cursor position)
As you can see "padding" entry is already pre-selected in my case. If I complete it using Space, Enter or Tab it will make .test{padding: |; with no leading space at all.

However, when I complete that very top entry "p (padding:...;) [Tab]", it will add that unwanted in your case leading space. The same will happen if you just type .test{p[Tab] fast.

Thing is -- that entry is Live Template entry (Settings | Live Templates | Zen CSS). If you find that entry in that screen and untick "Reformat according to style", it will not add any extra spaces as it will expand template as is (without processing any formatting rules).


hey, thanks for this - didn't even know there was something like zen coding for css. great stuff!
your solution definitly works (unticking the 'reformat' checkbox), although it's a bit cumbersome to do this for every entry in the list.
as it says 'reformat according to style', maybe there's a way of configuring this 'style'?


I do not think so  -- as you can see Settings | Code Style | CSS has very little formatting options available (compared to other languages). But try -- maybe you will find some combination.

What about just allowing IDE to insert all those spaces etc .. and when done editing, just use 3rd party tool to beautify your CSS? Have a look at CSSComb (ingetration done via External Tools functionality):


couldn't find any formatting option for this, but css comb is nice, i'll try that. thanks again!


Please sign in to leave a comment.