Search code examples
idephpstormcommentswebstorm

How to change comment type in PhpStorm


Currently in my css files using the keyboard shortcut for a comment it will apply a comment with //.

However I would like to use a comment style like so /* comment */

Are you able to change this in PhpStorm/WebStorm?


Solution

  • // is not valid as comment symbol in plain CSS files. The IDE uses correct /* */ style here.

    If the IDE actually uses that for comments in CSS files then check what CSS Dialect is set in Settings/Preferences | Languages & Frameworks | Stylesheets | Dialects. It sounds like it may set it to PostCSS (where // is valid).

    Another possibility: *.css files are associated with some other File Type (e.g. already mentioned PostCSS or perhaps Less/Sass).


    In any case: you may force /* */ for comments even for PostCSS: just use the Block Comment shortcut instead of just Comment. You will have to make a selection first though...

    Code | Comment with Block Comment (Ctrl + Shift + / using most keymaps).